Replace KotlinBodySpec with proper ResponseSpec extensions #28144
Labels
in: test
Issues in the test module
theme: kotlin
An issue related to Kotlin support
type: enhancement
A general enhancement
Milestone
Due to #20606, we had to introduce
KotlinBodySpec
in Spring Framework 5.0.x in order to unlock Kotlin developers for most common use cases ofWebTestClient
in Kotlin.As of Kotlin 1.6, the related Kotlin issue on recursive generic types has been fixed, making it possible for Spring Framework to provide regular reified extensions for
ResponseSpec
methods that takes aParameterizedTypeReference
(to be verified of course, but that's my current understanding).As a consequence, my proposal is in Spring Framework 6 to remove
KotlinBodySpec
, as well as the currentinline fun <reified B : Any> ResponseSpec.expectBody(): KotlinBodySpec<B>
extension, and introduce regular reified extensions forResponseSpec.expectBody
sinceResponseSpec.expectBodyList
,ResponseSpec.returnResult
extensions already exists.This is a breaking change, I am afraid impossible to avoid, so it should be mentioned in the release notes. I am not sure we should deprecate the related extension in Spring Framework 5.3 since we need to support Kotlin 1.5 there and the current extension prevent to introduce the new proper one describe in this issue.
The text was updated successfully, but these errors were encountered: