|
|
|
|
@ -20,6 +20,7 @@ import org.assertj.core.api.Assertions.assertThat
@@ -20,6 +20,7 @@ import org.assertj.core.api.Assertions.assertThat
|
|
|
|
|
import org.assertj.core.api.ThrowingConsumer |
|
|
|
|
import org.junit.jupiter.api.Test |
|
|
|
|
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates |
|
|
|
|
import java.lang.reflect.Method |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Tests for Kotlin support in [BindingReflectionHintsRegistrar]. |
|
|
|
|
@ -67,6 +68,16 @@ class KotlinBindingReflectionHintsRegistrarTests {
@@ -67,6 +68,16 @@ class KotlinBindingReflectionHintsRegistrarTests {
|
|
|
|
|
assertThat(RuntimeHintsPredicates.reflection().onMethod(SampleDataClass::class.java, "component1")).accepts(hints) |
|
|
|
|
assertThat(RuntimeHintsPredicates.reflection().onMethod(SampleDataClass::class.java, "copy")).accepts(hints) |
|
|
|
|
assertThat(RuntimeHintsPredicates.reflection().onMethod(SampleDataClass::class.java, "getName")).accepts(hints) |
|
|
|
|
val copyDefault: Method = SampleDataClass::class.java.getMethod("copy\$default", SampleDataClass::class.java, |
|
|
|
|
String::class.java , Int::class.java, Object::class.java) |
|
|
|
|
assertThat(RuntimeHintsPredicates.reflection().onMethod(copyDefault)).accepts(hints) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
fun `Register reflection hints on declared methods for Kotlin class`() { |
|
|
|
|
bindingRegistrar.registerReflectionHints(hints.reflection(), SampleClass::class.java) |
|
|
|
|
assertThat(RuntimeHintsPredicates.reflection().onType(SampleClass::class.java) |
|
|
|
|
.withMemberCategory(MemberCategory.INTROSPECT_DECLARED_METHODS)).accepts(hints) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -74,3 +85,5 @@ class KotlinBindingReflectionHintsRegistrarTests {
@@ -74,3 +85,5 @@ class KotlinBindingReflectionHintsRegistrarTests {
|
|
|
|
|
class SampleSerializableClass(val name: String) |
|
|
|
|
|
|
|
|
|
data class SampleDataClass(val name: String) |
|
|
|
|
|
|
|
|
|
class SampleClass(val name: String) |
|
|
|
|
|