@@ -56,4 +56,66 @@ void registerHints() {
56
56
assertThat (registeredTypes .contains (TypeReference .of (MistralAiEmbeddingOptions .class ))).isTrue ();
57
57
}
58
58
59
+ @ Test
60
+ void registerHintsWithNullClassLoader () {
61
+ RuntimeHints runtimeHints = new RuntimeHints ();
62
+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
63
+
64
+ // Should not throw exception with null classLoader
65
+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
66
+
67
+ // Verify hints were registered
68
+ assertThat (runtimeHints .reflection ().typeHints ().count ()).isGreaterThan (0 );
69
+ }
70
+
71
+ @ Test
72
+ void registerHintsWithValidClassLoader () {
73
+ RuntimeHints runtimeHints = new RuntimeHints ();
74
+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
75
+ ClassLoader classLoader = Thread .currentThread ().getContextClassLoader ();
76
+
77
+ mistralAiRuntimeHints .registerHints (runtimeHints , classLoader );
78
+
79
+ // Verify hints were registered
80
+ assertThat (runtimeHints .reflection ().typeHints ().count ()).isGreaterThan (0 );
81
+ }
82
+
83
+ @ Test
84
+ void registerHintsIsIdempotent () {
85
+ RuntimeHints runtimeHints = new RuntimeHints ();
86
+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
87
+
88
+ // Register hints twice
89
+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
90
+ long firstCount = runtimeHints .reflection ().typeHints ().count ();
91
+
92
+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
93
+ long secondCount = runtimeHints .reflection ().typeHints ().count ();
94
+
95
+ // Should have same number of hints
96
+ assertThat (firstCount ).isEqualTo (secondCount );
97
+ }
98
+
99
+ @ Test
100
+ void verifyExpectedTypesAreRegistered () {
101
+ RuntimeHints runtimeHints = new RuntimeHints ();
102
+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
103
+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
104
+
105
+ Set <TypeReference > registeredTypes = new HashSet <>();
106
+ runtimeHints .reflection ().typeHints ().forEach (typeHint -> registeredTypes .add (typeHint .getType ()));
107
+
108
+ // Verify some expected types are registered (adjust class names as needed)
109
+ assertThat (registeredTypes .stream ().anyMatch (tr -> tr .getName ().contains ("MistralAi" ))).isTrue ();
110
+ assertThat (registeredTypes .stream ().anyMatch (tr -> tr .getName ().contains ("ChatCompletion" ))).isTrue ();
111
+ }
112
+
113
+ @ Test
114
+ void verifyPackageScanningWorks () {
115
+ Set <TypeReference > jsonAnnotatedClasses = findJsonAnnotatedClassesInPackage ("org.springframework.ai.mistralai" );
116
+
117
+ // Verify package scanning found classes
118
+ assertThat (jsonAnnotatedClasses .size ()).isGreaterThan (0 );
119
+ }
120
+
59
121
}
0 commit comments