@@ -150,12 +150,12 @@ public void pojo_emptyStringAsNullObject() throws Exception {
150150 String json = "{\" name\" :\" \" , \" age\" :30}" ;
151151
152152 // POJO with default OBJECT_MAPPER (feature enabled)
153- Person person = ModelOptionsUtils .OBJECT_MAPPER .readValue (json , Person .class );
153+ Person person = ModelOptionsUtils .getObjectMapper () .readValue (json , Person .class );
154154 assertThat (person .name ).isEqualTo ("" ); // String remains ""
155155 assertThat (person .age ).isEqualTo (30 ); // Integer is fine
156156
157157 String jsonWithEmptyAge = "{\" name\" :\" John\" , \" age\" :\" \" }" ;
158- Person person2 = ModelOptionsUtils .OBJECT_MAPPER .readValue (jsonWithEmptyAge , Person .class );
158+ Person person2 = ModelOptionsUtils .getObjectMapper () .readValue (jsonWithEmptyAge , Person .class );
159159 assertThat (person2 .name ).isEqualTo ("John" );
160160 assertThat (person2 .age ).isNull (); // Integer: "" → null
161161
@@ -182,35 +182,35 @@ record TestRecord(@JsonProperty("field1") String fieldA, @JsonProperty("field2")
182182 @ Test
183183 public void enumCoercion_emptyStringAsNull () throws JsonProcessingException {
184184 // Test direct enum deserialization with empty string
185- ColorEnum colorEnum = ModelOptionsUtils .OBJECT_MAPPER .readValue ("\" \" " , ColorEnum .class );
185+ ColorEnum colorEnum = ModelOptionsUtils .getObjectMapper () .readValue ("\" \" " , ColorEnum .class );
186186 assertThat (colorEnum ).isNull ();
187187
188188 // Test direct enum deserialization with valid value
189- colorEnum = ModelOptionsUtils .OBJECT_MAPPER .readValue ("\" RED\" " , ColorEnum .class );
189+ colorEnum = ModelOptionsUtils .getObjectMapper () .readValue ("\" RED\" " , ColorEnum .class );
190190 assertThat (colorEnum ).isEqualTo (ColorEnum .RED );
191191
192192 // Test direct enum deserialization with invalid value should throw exception
193193 final String jsonInvalid = "\" Invalid\" " ;
194- assertThatThrownBy (() -> ModelOptionsUtils .OBJECT_MAPPER .readValue (jsonInvalid , ColorEnum .class ))
194+ assertThatThrownBy (() -> ModelOptionsUtils .getObjectMapper () .readValue (jsonInvalid , ColorEnum .class ))
195195 .isInstanceOf (JsonProcessingException .class );
196196 }
197197
198198 @ Test
199199 public void enumCoercion_objectMapperConfiguration () throws JsonProcessingException {
200- // Test that ModelOptionsUtils.OBJECT_MAPPER has the correct coercion
200+ // Test that ModelOptionsUtils.getObjectMapper() has the correct coercion
201201 // configuration
202202 // This validates that our static configuration block is working
203203
204204 // Empty string should coerce to null for enums
205- ColorEnum colorEnum = ModelOptionsUtils .OBJECT_MAPPER .readValue ("\" \" " , ColorEnum .class );
205+ ColorEnum colorEnum = ModelOptionsUtils .getObjectMapper () .readValue ("\" \" " , ColorEnum .class );
206206 assertThat (colorEnum ).isNull ();
207207
208208 // Null should remain null
209- colorEnum = ModelOptionsUtils .OBJECT_MAPPER .readValue ("null" , ColorEnum .class );
209+ colorEnum = ModelOptionsUtils .getObjectMapper () .readValue ("null" , ColorEnum .class );
210210 assertThat (colorEnum ).isNull ();
211211
212212 // Valid enum values should deserialize correctly
213- colorEnum = ModelOptionsUtils .OBJECT_MAPPER .readValue ("\" BLUE\" " , ColorEnum .class );
213+ colorEnum = ModelOptionsUtils .getObjectMapper () .readValue ("\" BLUE\" " , ColorEnum .class );
214214 assertThat (colorEnum ).isEqualTo (ColorEnum .BLUE );
215215 }
216216
@@ -224,8 +224,8 @@ public void enumCoercion_apiResponseWithFinishReason() throws JsonProcessingExce
224224 }
225225 """ ;
226226
227- TestApiResponse response = ModelOptionsUtils .OBJECT_MAPPER . readValue ( jsonWithEmptyFinishReason ,
228- TestApiResponse .class );
227+ TestApiResponse response = ModelOptionsUtils .getObjectMapper ()
228+ . readValue ( jsonWithEmptyFinishReason , TestApiResponse .class );
229229 assertThat (response .id ()).isEqualTo ("test-123" );
230230 assertThat (response .finishReason ()).isNull ();
231231
@@ -238,7 +238,7 @@ public void enumCoercion_apiResponseWithFinishReason() throws JsonProcessingExce
238238 }
239239 """ ;
240240
241- response = ModelOptionsUtils .OBJECT_MAPPER .readValue (jsonWithValidFinishReason , TestApiResponse .class );
241+ response = ModelOptionsUtils .getObjectMapper () .readValue (jsonWithValidFinishReason , TestApiResponse .class );
242242 assertThat (response .id ()).isEqualTo ("test-456" );
243243 assertThat (response .finishReason ()).isEqualTo (TestFinishReason .STOP );
244244
@@ -250,7 +250,7 @@ public void enumCoercion_apiResponseWithFinishReason() throws JsonProcessingExce
250250 }
251251 """ ;
252252
253- response = ModelOptionsUtils .OBJECT_MAPPER .readValue (jsonWithNullFinishReason , TestApiResponse .class );
253+ response = ModelOptionsUtils .getObjectMapper () .readValue (jsonWithNullFinishReason , TestApiResponse .class );
254254 assertThat (response .id ()).isEqualTo ("test-789" );
255255 assertThat (response .finishReason ()).isNull ();
256256
@@ -263,7 +263,7 @@ public void enumCoercion_apiResponseWithFinishReason() throws JsonProcessingExce
263263 """ ;
264264
265265 assertThatThrownBy (
266- () -> ModelOptionsUtils .OBJECT_MAPPER .readValue (jsonWithInvalidFinishReason , TestApiResponse .class ))
266+ () -> ModelOptionsUtils .getObjectMapper () .readValue (jsonWithInvalidFinishReason , TestApiResponse .class ))
267267 .isInstanceOf (JsonProcessingException .class )
268268 .hasMessageContaining ("INVALID_VALUE" );
269269 }
0 commit comments