44import com .fasterxml .jackson .databind .JsonNode ;
55import com .fasterxml .jackson .databind .ObjectMapper ;
66import com .fasterxml .jackson .databind .PropertyNamingStrategies ;
7+ import com .fasterxml .jackson .databind .json .JsonMapper ;
78import com .fasterxml .jackson .databind .node .JsonNodeType ;
89import io .github .springwolf .core .controller .dtos .MessageDto ;
9- import io .swagger .v3 .core .util .Json ;
1010import org .junit .jupiter .api .Test ;
1111
1212import static java .util .Collections .singletonMap ;
1313import static org .assertj .core .api .Assertions .assertThat ;
1414
1515class MessageDtoTest {
16- private static final ObjectMapper objectMapper = Json . mapper ();
16+ private static final JsonMapper jsonMapper = JsonMapper . builder (). build ();
1717
1818 @ Test
1919 void canBeSerialized () throws Exception {
@@ -22,7 +22,7 @@ void canBeSerialized() throws Exception {
2222 + "\" type\" : \" "
2323 + MessageDto .class .getCanonicalName () + "\" " + "}" ;
2424
25- MessageDto value = objectMapper .readValue (content , MessageDto .class );
25+ MessageDto value = jsonMapper .readValue (content , MessageDto .class );
2626
2727 assertThat (value ).isNotNull ();
2828 assertThat (value .getHeaders ())
@@ -42,8 +42,8 @@ void serializationWithDifferentNamingStrategiesIsIndifferent() throws Exception
4242 .type (MessageDto .class .getCanonicalName ())
4343 .build ();
4444
45- String expected = objectMapper .writeValueAsString (messageDto );
46- String actual = objectMapper
45+ String expected = jsonMapper .writeValueAsString (messageDto );
46+ String actual = jsonMapper
4747 .copy ()
4848 .setPropertyNamingStrategy (PropertyNamingStrategies .SNAKE_CASE )
4949 .writeValueAsString (messageDto );
@@ -57,7 +57,7 @@ void canDeserializeStringHeaderValue() throws Exception {
5757 String content = "\" 12345\" " ;
5858
5959 // when
60- MessageDto .HeaderValue value = objectMapper .readValue (content , MessageDto .HeaderValue .class );
60+ MessageDto .HeaderValue value = jsonMapper .readValue (content , MessageDto .HeaderValue .class );
6161
6262 // then
6363 assertThat (value ).isEqualTo (new MessageDto .HeaderValue ("12345" ));
@@ -69,7 +69,7 @@ void canDeserializeNumericHeaderValue() throws Exception {
6969 String content = "12345" ;
7070
7171 // when
72- MessageDto .HeaderValue value = objectMapper .readValue (content , MessageDto .HeaderValue .class );
72+ MessageDto .HeaderValue value = jsonMapper .readValue (content , MessageDto .HeaderValue .class );
7373
7474 // then
7575 assertThat (value ).isEqualTo (new MessageDto .HeaderValue ("12345" ));
@@ -81,7 +81,7 @@ void canSerializeNumericHeaderValue() throws Exception {
8181 MessageDto .HeaderValue headerValue = new MessageDto .HeaderValue ("12345" );
8282
8383 // when
84- JsonNode json = objectMapper .valueToTree (headerValue );
84+ JsonNode json = jsonMapper .valueToTree (headerValue );
8585
8686 // then
8787 assertThat (json .getNodeType ()).isEqualTo (JsonNodeType .NUMBER );
0 commit comments