Make ResponseSpec.expectBody Kotlin extension usable

Prior to this commit, due to KT-5464 type inference issue there was not
proper way to provide body expectations with WebTestClient. This commit
provides a workaround by updating the existing Kotlin extension to
return a Kotlin compatible API.

Issue: SPR-15692
This commit is contained in:
sdeleuze
2018-04-17 14:32:53 +02:00
parent 9d37c099a8
commit 91c8b62817
3 changed files with 76 additions and 9 deletions

View File

@@ -663,13 +663,11 @@ class SpecificationLikeTests {
[[kotlin-webtestclient-issue]]
==== `WebTestClient` type inference issue in Kotlin
`WebTestClient` is not usable yet in Kotlin due to a
https://youtrack.jetbrains.com/issue/KT-5464[type inference issue] which is
expected to be fixed as of Kotlin 1.3. You can watch
https://jira.spring.io/browse/SPR-16057[SPR-16057] for up-to-date information. Meanwhile,
the proposed alternative is to use directly `WebClient` with its Reactor and Spring Kotlin
extensions to perform integration tests on an embedded WebFlux server.
Due to a https://youtrack.jetbrains.com/issue/KT-5464[type inference issue], make sure to
use Kotlin `expectBody` extension (like `.expectBody<String>().isEqualTo("foo")`) since it
provides a workaround for the Kotlin issue with the Java API.
See also the related https://jira.spring.io/browse/SPR-16057[SPR-16057] issue.