Create Kotlin Spring WebFlux module

This commit is contained in:
Andrey Shcherbakov
2018-07-14 21:24:33 +02:00
parent de2afd7da8
commit 08b0b8095a
9 changed files with 247 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package veontomo
import com.baeldung.springreactivekotlin.SimpleRoute
import org.junit.Before
import org.junit.Test
import org.springframework.test.web.reactive.server.WebTestClient
class RoutesTest {
lateinit var client: WebTestClient
@Before
fun init() {
this.client = WebTestClient.bindToRouterFunction(SimpleRoute().route()).build()
}
@Test
fun whenRequestToRoute_thenStatusShouldBeOk() {
client.get()
.uri("/route")
.exchange()
.expectStatus().isOk
}
@Test
fun whenRequestToRoute_thenBodyShouldContainArray123() {
client.get()
.uri("/route")
.exchange()
.expectBody()
.json("[1, 2, 3]")
}
}