@@ -118,4 +118,60 @@ void verifyPackageScanningWorks() {
118118 assertThat (jsonAnnotatedClasses .size ()).isGreaterThan (0 );
119119 }
120120
121+ @ Test
122+ void verifyAllCriticalApiClassesAreRegistered () {
123+ RuntimeHints runtimeHints = new RuntimeHints ();
124+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
125+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
126+
127+ Set <TypeReference > registeredTypes = new HashSet <>();
128+ runtimeHints .reflection ().typeHints ().forEach (typeHint -> registeredTypes .add (typeHint .getType ()));
129+
130+ // Critical API classes that must be registered for runtime
131+ String [] criticalClasses = { "MistralAiApi$ChatCompletionRequest" , "MistralAiApi$ChatCompletionMessage" ,
132+ "MistralAiApi$EmbeddingRequest" , "MistralAiApi$EmbeddingList" , "MistralAiApi$Usage" };
133+
134+ for (String className : criticalClasses ) {
135+ assertThat (registeredTypes .stream ()
136+ .anyMatch (tr -> tr .getName ().contains (className .replace ("$" , "." ))
137+ || tr .getName ().contains (className .replace ("$" , "$" ))))
138+ .as ("Critical class %s should be registered" , className )
139+ .isTrue ();
140+ }
141+ }
142+
143+ @ Test
144+ void verifyEnumTypesAreRegistered () {
145+ RuntimeHints runtimeHints = new RuntimeHints ();
146+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
147+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
148+
149+ Set <TypeReference > registeredTypes = new HashSet <>();
150+ runtimeHints .reflection ().typeHints ().forEach (typeHint -> registeredTypes .add (typeHint .getType ()));
151+
152+ // Enums are critical for JSON deserialization in native images
153+ assertThat (registeredTypes .contains (TypeReference .of (MistralAiApi .ChatModel .class )))
154+ .as ("ChatModel enum should be registered" )
155+ .isTrue ();
156+
157+ assertThat (registeredTypes .contains (TypeReference .of (MistralAiApi .EmbeddingModel .class )))
158+ .as ("EmbeddingModel enum should be registered" )
159+ .isTrue ();
160+ }
161+
162+ @ Test
163+ void verifyReflectionHintsIncludeConstructors () {
164+ RuntimeHints runtimeHints = new RuntimeHints ();
165+ MistralAiRuntimeHints mistralAiRuntimeHints = new MistralAiRuntimeHints ();
166+ mistralAiRuntimeHints .registerHints (runtimeHints , null );
167+
168+ // Verify that reflection hints include constructor access
169+ boolean hasConstructorHints = runtimeHints .reflection ()
170+ .typeHints ()
171+ .anyMatch (typeHint -> typeHint .constructors ().findAny ().isPresent () || typeHint .getMemberCategories ()
172+ .contains (org .springframework .aot .hint .MemberCategory .INVOKE_DECLARED_CONSTRUCTORS ));
173+
174+ assertThat (hasConstructorHints ).as ("Should register constructor hints for JSON deserialization" ).isTrue ();
175+ }
176+
121177}
0 commit comments