Merge branch '6.1.x'
This commit is contained in:
@@ -19,6 +19,7 @@ package org.springframework.web.reactive.result
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import kotlinx.coroutines.delay
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.core.MethodParameter
|
||||
@@ -41,6 +42,7 @@ import reactor.core.publisher.Mono
|
||||
import reactor.test.StepVerifier
|
||||
import java.lang.reflect.Method
|
||||
import java.time.Duration
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.jvm.javaMethod
|
||||
|
||||
/**
|
||||
@@ -197,6 +199,14 @@ class InvocableHandlerMethodKotlinTests {
|
||||
assertHandlerResultValue(result, "3.1")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun valueClassWithInit() {
|
||||
this.resolvers.add(stubResolver("", String::class.java))
|
||||
val method = ValueClassController::valueClassWithInit.javaMethod!!
|
||||
val result = invoke(ValueClassController(), method)
|
||||
assertExceptionThrown(result, IllegalArgumentException::class)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun propertyAccessor() {
|
||||
this.resolvers.add(stubResolver(null, String::class.java))
|
||||
@@ -256,6 +266,10 @@ class InvocableHandlerMethodKotlinTests {
|
||||
}.verifyComplete()
|
||||
}
|
||||
|
||||
private fun assertExceptionThrown(mono: Mono<HandlerResult>, exceptionClass: KClass<out Throwable>) {
|
||||
StepVerifier.create(mono).verifyError(exceptionClass.java)
|
||||
}
|
||||
|
||||
class CoroutinesController {
|
||||
|
||||
suspend fun singleArg(q: String?): String {
|
||||
@@ -320,6 +334,9 @@ class InvocableHandlerMethodKotlinTests {
|
||||
fun valueClassWithDefault(limit: DoubleValueClass = DoubleValueClass(3.1)) =
|
||||
"${limit.value}"
|
||||
|
||||
fun valueClassWithInit(valueClass: ValueClassWithInit) =
|
||||
valueClass
|
||||
|
||||
}
|
||||
|
||||
class PropertyAccessorController {
|
||||
@@ -346,5 +363,14 @@ class InvocableHandlerMethodKotlinTests {
|
||||
@JvmInline
|
||||
value class DoubleValueClass(val value: Double)
|
||||
|
||||
@JvmInline
|
||||
value class ValueClassWithInit(val value: String) {
|
||||
init {
|
||||
if (value.isEmpty()) {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CustomException(message: String) : Throwable(message)
|
||||
}
|
||||
Reference in New Issue
Block a user