@@ -19,7 +19,6 @@ package org.springframework.web.reactive.result
19
19
import io.mockk.every
20
20
import io.mockk.mockk
21
21
import kotlinx.coroutines.delay
22
- import org.assertj.core.api.Assertions
23
22
import org.assertj.core.api.Assertions.assertThat
24
23
import org.junit.jupiter.api.Test
25
24
import org.springframework.core.MethodParameter
@@ -178,11 +177,19 @@ class InvocableHandlerMethodKotlinTests {
178
177
179
178
@Test
180
179
fun nullReturnValue () {
181
- val method = NullResultController ::nullable .javaMethod!!
180
+ val method = NullResultController ::nullableReturnValue .javaMethod!!
182
181
val result = invoke(NullResultController (), method)
183
182
assertHandlerResultValue(result, null )
184
183
}
185
184
185
+ @Test
186
+ fun nullParameter () {
187
+ this .resolvers.add(stubResolver(null , String ::class .java))
188
+ val method = NullResultController ::nullableParameter.javaMethod!!
189
+ val result = invoke(NullResultController (), method, null )
190
+ assertHandlerResultValue(result, null )
191
+ }
192
+
186
193
@Test
187
194
fun valueClass () {
188
195
this .resolvers.add(stubResolver(1L , Long ::class .java))
@@ -192,7 +199,7 @@ class InvocableHandlerMethodKotlinTests {
192
199
}
193
200
194
201
@Test
195
- fun valueClassDefaultValue () {
202
+ fun valueClassWithDefaultValue () {
196
203
this .resolvers.add(stubResolver(null , Double ::class .java))
197
204
val method = ValueClassController ::valueClassWithDefault.javaMethod!!
198
205
val result = invoke(ValueClassController (), method)
@@ -207,6 +214,14 @@ class InvocableHandlerMethodKotlinTests {
207
214
assertExceptionThrown(result, IllegalArgumentException ::class )
208
215
}
209
216
217
+ @Test
218
+ fun valueClassWithNullable () {
219
+ this .resolvers.add(stubResolver(null , LongValueClass ::class .java))
220
+ val method = ValueClassController ::valueClassWithNullable.javaMethod!!
221
+ val result = invoke(ValueClassController (), method, null )
222
+ assertHandlerResultValue(result, " null" )
223
+ }
224
+
210
225
@Test
211
226
fun propertyAccessor () {
212
227
this .resolvers.add(stubResolver(null , String ::class .java))
@@ -321,9 +336,13 @@ class InvocableHandlerMethodKotlinTests {
321
336
fun unit () {
322
337
}
323
338
324
- fun nullable (): String? {
339
+ fun nullableReturnValue (): String? {
325
340
return null
326
341
}
342
+
343
+ fun nullableParameter (value : String? ): String? {
344
+ return value
345
+ }
327
346
}
328
347
329
348
class ValueClassController {
@@ -337,6 +356,9 @@ class InvocableHandlerMethodKotlinTests {
337
356
fun valueClassWithInit (valueClass : ValueClassWithInit ) =
338
357
valueClass
339
358
359
+ fun valueClassWithNullable (limit : LongValueClass ? ) =
360
+ " ${limit?.value} "
361
+
340
362
}
341
363
342
364
class PropertyAccessorController {
0 commit comments