upgrade to Spring Boot 4.2.1
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
package de.hoennig.gittally
|
||||
|
||||
import io.kotest.core.config.AbstractProjectConfig
|
||||
import io.kotest.extensions.spring.SpringExtension
|
||||
|
||||
object KotestProjectConfig : AbstractProjectConfig() {
|
||||
override fun extensions() = listOf(SpringExtension)
|
||||
}
|
||||
@@ -10,14 +10,15 @@ interface Greeter {
|
||||
fun greet(name: String): String
|
||||
}
|
||||
|
||||
class MockKSmokeTest : FunSpec({
|
||||
class MockKSmokeTest :
|
||||
FunSpec({
|
||||
|
||||
test("mockk stubs and verifies") {
|
||||
val greeter = mockk<Greeter>()
|
||||
every { greeter.greet("world") } returns "hello, world"
|
||||
test("mockk stubs and verifies") {
|
||||
val greeter = mockk<Greeter>()
|
||||
every { greeter.greet("world") } returns "hello, world"
|
||||
|
||||
greeter.greet("world") shouldBe "hello, world"
|
||||
greeter.greet("world") shouldBe "hello, world"
|
||||
|
||||
verify(exactly = 1) { greeter.greet("world") }
|
||||
}
|
||||
})
|
||||
verify(exactly = 1) { greeter.greet("world") }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -21,7 +21,6 @@ interface MessageService {
|
||||
@SpringBootTest
|
||||
@Import(SpringMockKSmokeTest.Mocks::class)
|
||||
class SpringMockKSmokeTest : FunSpec() {
|
||||
|
||||
@TestConfiguration
|
||||
class Mocks {
|
||||
@Bean
|
||||
@@ -47,7 +46,6 @@ class SpringMockKSmokeTest : FunSpec() {
|
||||
/** Verifies whether @MockkBean works with the current Spring Boot version (springmockk 4.0.2). */
|
||||
@SpringBootTest
|
||||
class MockkBeanSmokeTest : FunSpec() {
|
||||
|
||||
@MockkBean
|
||||
lateinit var messageService: MessageService
|
||||
|
||||
|
||||
@@ -5,13 +5,15 @@ import io.kotest.matchers.shouldBe
|
||||
import org.testcontainers.containers.GenericContainer
|
||||
import org.testcontainers.utility.DockerImageName
|
||||
|
||||
class TestcontainersSmokeTest : FunSpec({
|
||||
class TestcontainersSmokeTest :
|
||||
FunSpec({
|
||||
|
||||
test("Testcontainers starts a container") {
|
||||
val container = GenericContainer(DockerImageName.parse("alpine:3"))
|
||||
.withCommand("sh", "-c", "sleep 30")
|
||||
container.start()
|
||||
container.isRunning shouldBe true
|
||||
container.stop()
|
||||
}
|
||||
})
|
||||
test("Testcontainers starts a container") {
|
||||
val container =
|
||||
GenericContainer(DockerImageName.parse("alpine:3"))
|
||||
.withCommand("sh", "-c", "sleep 30")
|
||||
container.start()
|
||||
container.isRunning shouldBe true
|
||||
container.stop()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -11,22 +11,24 @@ import java.net.http.HttpClient
|
||||
import java.net.http.HttpRequest
|
||||
import java.net.http.HttpResponse
|
||||
|
||||
class WireMockSmokeTest : FunSpec({
|
||||
class WireMockSmokeTest :
|
||||
FunSpec({
|
||||
|
||||
val server = WireMockServer(options().dynamicPort())
|
||||
val server = WireMockServer(options().dynamicPort())
|
||||
|
||||
beforeSpec { server.start() }
|
||||
afterSpec { server.stop() }
|
||||
beforeSpec { server.start() }
|
||||
afterSpec { server.stop() }
|
||||
|
||||
test("WireMock stubs an HTTP endpoint") {
|
||||
server.stubFor(get("/ping").willReturn(aResponse().withStatus(200).withBody("pong")))
|
||||
test("WireMock stubs an HTTP endpoint") {
|
||||
server.stubFor(get("/ping").willReturn(aResponse().withStatus(200).withBody("pong")))
|
||||
|
||||
val response = HttpClient.newHttpClient().send(
|
||||
HttpRequest.newBuilder().uri(URI.create("http://localhost:${server.port()}/ping")).build(),
|
||||
HttpResponse.BodyHandlers.ofString(),
|
||||
)
|
||||
val response =
|
||||
HttpClient.newHttpClient().send(
|
||||
HttpRequest.newBuilder().uri(URI.create("http://localhost:${server.port()}/ping")).build(),
|
||||
HttpResponse.BodyHandlers.ofString(),
|
||||
)
|
||||
|
||||
response.statusCode() shouldBe 200
|
||||
response.body() shouldBe "pong"
|
||||
}
|
||||
})
|
||||
response.statusCode() shouldBe 200
|
||||
response.body() shouldBe "pong"
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user