Make Kotlin functions accessible in CoroutinesUtils
In order to allow using private classes like in Java for example. Closes gh-23840
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -97,6 +97,14 @@ class KotlinInvocableHandlerMethodTests {
|
||||
assertThat(this.exchange.response.headers.getFirst("foo")).isEqualTo("bar")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun privateController() {
|
||||
this.resolvers.add(stubResolver("foo"))
|
||||
val method = PrivateCoroutinesController::singleArg.javaMethod!!
|
||||
val result = invoke(PrivateCoroutinesController(), method,"foo")
|
||||
assertHandlerResultValue(result, "success:foo")
|
||||
}
|
||||
|
||||
private fun invoke(handler: Any, method: Method, vararg providedArgs: Any?): Mono<HandlerResult> {
|
||||
val invocable = InvocableHandlerMethod(handler, method)
|
||||
invocable.setArgumentResolvers(this.resolvers)
|
||||
@@ -146,7 +154,13 @@ class KotlinInvocableHandlerMethodTests {
|
||||
delay(10)
|
||||
response.headers.add("foo", "bar")
|
||||
}
|
||||
}
|
||||
|
||||
private class PrivateCoroutinesController {
|
||||
|
||||
suspend fun singleArg(q: String?): String {
|
||||
delay(10)
|
||||
return "success:$q"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user