1
1
/*
2
- * Copyright 2002-2024 the original author or authors.
2
+ * Copyright 2002-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -81,6 +81,12 @@ class BindingReflectionHintsRegistrarKotlinTests {
81
81
assertThat(RuntimeHintsPredicates .reflection().onType(SampleClass ::class .java)
82
82
.withMemberCategory(MemberCategory .INTROSPECT_DECLARED_METHODS )).accepts(hints)
83
83
}
84
+
85
+ @Test
86
+ fun `Register reflection hints on serializer function with parameter` () {
87
+ bindingRegistrar.registerReflectionHints(hints.reflection(), SampleResult ::class .java)
88
+ assertThat(RuntimeHintsPredicates .reflection().onMethod(SampleResult .Companion ::class .java, " serializer" )).accepts(hints)
89
+ }
84
90
}
85
91
86
92
@kotlinx.serialization.Serializable
@@ -89,3 +95,17 @@ class SampleSerializableClass(val name: String)
89
95
data class SampleDataClass (val name : String , val isNonNullable : Boolean , val isNullable : Boolean? )
90
96
91
97
class SampleClass (val name : String )
98
+
99
+ @kotlinx.serialization.Serializable
100
+ data class SampleResult <T >(
101
+ val code : Int ,
102
+ val message : String ,
103
+ val data : T ,
104
+ ) {
105
+ companion object {
106
+ private const val SUCCESS : Int = 200
107
+ private const val FAILURE : Int = 500
108
+ fun <T > success (message : String , data : T ) = SampleResult <T >(code = SUCCESS , message = message, data = data)
109
+ fun <T > failure (message : String , data : T ) = SampleResult <T >(code = FAILURE , message = message, data = data)
110
+ }
111
+ }
0 commit comments