File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
arex-instrumentation-foundation/src
main/java/io/arex/foundation/serializer
test/java/io/arex/foundation/serializer Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -312,7 +312,7 @@ static class LocalDateTimeDeserialize extends com.fasterxml.jackson.databind.Jso
312312 public LocalDateTime deserialize (JsonParser p , DeserializationContext ctxt ) throws IOException {
313313 JsonNode node = p .getCodec ().readTree (p );
314314 return LocalDateTime .parse (node .asText (),
315- DateFormatParser .INSTANCE .getFormatter (node . asText (), DatePatternConstants .localDateTimeFormat ));
315+ DateFormatParser .INSTANCE .getFormatter (DatePatternConstants .localDateTimeFormat ));
316316 }
317317 }
318318
@@ -354,7 +354,7 @@ static class LocalTimeDeserialize extends com.fasterxml.jackson.databind.JsonDes
354354 public LocalTime deserialize (JsonParser p , DeserializationContext ctxt ) throws IOException {
355355 JsonNode node = p .getCodec ().readTree (p );
356356 return LocalTime .parse (node .asText (), DateFormatParser .INSTANCE
357- .getFormatter (node . asText (), DatePatternConstants .localTimeFormat ));
357+ .getFormatter (DatePatternConstants .localTimeFormat ));
358358 }
359359 }
360360
Original file line number Diff line number Diff line change 1+ package io .arex .foundation .serializer ;
2+
3+ import static org .junit .jupiter .api .Assertions .*;
4+
5+ import java .time .LocalDateTime ;
6+ import org .junit .jupiter .api .Test ;
7+
8+ class JacksonSerializerTest {
9+ @ Test
10+ void testLocalDateTime () {
11+ LocalDateTime now = LocalDateTime .now ();
12+ String json = JacksonSerializer .INSTANCE .serialize (now );
13+ LocalDateTime actualResult = JacksonSerializer .INSTANCE .deserialize (json , LocalDateTime .class );
14+ assertEquals (now , actualResult );
15+ }
16+
17+ @ Test
18+ void testLocalTime () {
19+ LocalDateTime now = LocalDateTime .now ();
20+ String json = JacksonSerializer .INSTANCE .serialize (now );
21+ LocalDateTime actualResult = JacksonSerializer .INSTANCE .deserialize (json , LocalDateTime .class );
22+ assertEquals (now , actualResult );
23+ }
24+
25+ }
You can’t perform that action at this time.
0 commit comments