@Test public void serialize() throws IOException { final ZonedDateTime dateTime = ZonedDateTime.of( 2018, 8, 19, 17, 22, 33, 321000000, ZoneId.ofOffset( "UTC", ZoneOffset.ofHours( 4 ) ) ); serializer.serialize( dateTime, jsonGenerator, serializerProvider ); Mockito.verify( jsonGenerator ).writeString( Mockito.eq( "2018-08-19T17:22:33.321+04:00" ) ); Mockito.verifyNoMoreInteractions( jsonGenerator ); }
@Override public void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ) throws IOException { if ( zonedDateTime == null ) { jsonGenerator.writeNull(); } else { jsonGenerator.writeString( zonedDateTime.format( DateTimeFormatter.ISO_OFFSET_DATE_TIME ) ); } }
ZonedDateTimeSerializer extends StdSerializer<ZonedDateTime> { @Override public void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ) throws IOException { if ( zonedDateTime == null ) { jsonGenerator.writeNull(); } else { jsonGenerator.writeString( zonedDateTime.format( DateTimeFormatter.ISO_OFFSET_DATE_TIME ) ); } } }
ZonedDateTimeSerializer extends StdSerializer<ZonedDateTime> { @Override public void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ) throws IOException { if ( zonedDateTime == null ) { jsonGenerator.writeNull(); } else { jsonGenerator.writeString( zonedDateTime.format( DateTimeFormatter.ISO_OFFSET_DATE_TIME ) ); } } ZonedDateTimeSerializer(); }
ZonedDateTimeSerializer extends StdSerializer<ZonedDateTime> { @Override public void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ) throws IOException { if ( zonedDateTime == null ) { jsonGenerator.writeNull(); } else { jsonGenerator.writeString( zonedDateTime.format( DateTimeFormatter.ISO_OFFSET_DATE_TIME ) ); } } ZonedDateTimeSerializer(); @Override void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ); }
ZonedDateTimeSerializer extends StdSerializer<ZonedDateTime> { @Override public void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider ) throws IOException { if ( zonedDateTime == null ) { jsonGenerator.writeNull(); } else { jsonGenerator.writeString( zonedDateTime.format( DateTimeFormatter.ISO_OFFSET_DATE_TIME ) ); } } ZonedDateTimeSerializer(); @Override void serialize( ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider );  }