1313
1414import com .fasterxml .jackson .annotation .JsonFormat ;
1515import com .fasterxml .jackson .annotation .JsonFormat .Feature ;
16+
1617import com .fasterxml .jackson .core .type .TypeReference ;
17- import com .fasterxml .jackson .databind .DeserializationFeature ;
18- import com .fasterxml .jackson .databind .ObjectMapper ;
19- import com .fasterxml .jackson .databind .ObjectReader ;
20- import com .fasterxml .jackson .databind .SerializationFeature ;
21- import com .fasterxml .jackson .databind .json .JsonMapper ;
18+
19+ import com .fasterxml .jackson .databind .*;
20+ import com .fasterxml .jackson .databind .module .SimpleModule ;
2221import com .fasterxml .jackson .databind .exc .MismatchedInputException ;
2322import com .fasterxml .jackson .datatype .jsr310 .DecimalUtils ;
2423import com .fasterxml .jackson .datatype .jsr310 .MockObjectConfiguration ;
@@ -876,9 +875,9 @@ private static String offsetWithoutColon(String string){
876875 }
877876
878877 /*
879- /**********************************************************
880- /* Tests for custom formatter (#376)
881- /**********************************************************
878+ /**********************************************************************
879+ /* Tests for custom formatter (modules-java8 #376)
880+ /**********************************************************************
882881 */
883882
884883 @ Test
@@ -897,12 +896,11 @@ public void testDeserializationWithCustomFormatter() throws Exception
897896
898897 // Create custom deserializer with the custom formatter
899898 InstantDeserializer <OffsetDateTime > customDeserializer =
900- InstantDeserializer .withCustomFormatter ( InstantDeserializer . OFFSET_DATE_TIME , customFormatter );
899+ InstantDeserializer .OFFSET_DATE_TIME . withDateFormat ( customFormatter );
901900
902901 // Create a custom module to override the default deserializer
903- com .fasterxml .jackson .databind .module .SimpleModule customModule =
904- new com .fasterxml .jackson .databind .module .SimpleModule ("CustomOffsetDateTimeModule" );
905- customModule .addDeserializer (OffsetDateTime .class , customDeserializer );
902+ SimpleModule customModule = new SimpleModule ("CustomOffsetDateTimeModule" )
903+ .addDeserializer (OffsetDateTime .class , customDeserializer );
906904
907905 // Add both JavaTimeModule (for other types) and our custom module
908906 // The custom module will override OffsetDateTime deserialization
@@ -949,11 +947,9 @@ public void testDeserializationWithCustomFormatterRoundTrip() throws Exception
949947 .toFormatter ();
950948
951949 InstantDeserializer <OffsetDateTime > customDeserializer =
952- InstantDeserializer .withCustomFormatter (InstantDeserializer .OFFSET_DATE_TIME , customFormatter );
953-
954- com .fasterxml .jackson .databind .module .SimpleModule customModule =
955- new com .fasterxml .jackson .databind .module .SimpleModule ();
956- customModule .addDeserializer (OffsetDateTime .class , customDeserializer );
950+ InstantDeserializer .OFFSET_DATE_TIME .withDateFormat (customFormatter );
951+ SimpleModule customModule = new SimpleModule ("CustomOffsetDateTimeModule" )
952+ .addDeserializer (OffsetDateTime .class , customDeserializer );
957953
958954 ObjectMapper mapper = mapperBuilder ()
959955 .addModule (customModule )
0 commit comments