@Test public void deserializeEmpty() throws IOException { Mockito.when( jsonParser.getText() ).thenReturn( " " ); Assert.assertNull( deserializer.deserialize( jsonParser, deserializationContext ) ); Mockito.verify( jsonParser ).getText(); Mockito.verifyNoMoreInteractions( jsonParser ); }
@Override public ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException { final String string = jsonParser.getText().trim(); if ( string.isEmpty() ) { return null; } try { if ( DateTimeUtils.containsDateTimeOffset( string ) ) { return ZonedDateTime.parse( string, DateTimeFormatter.ISO_DATE_TIME ); } else { return ZonedDateTime.of( LocalDateTime.parse( string, DateTimeFormatter.ISO_LOCAL_DATE_TIME ), zoneId ); } } catch ( DateTimeParseException e ) { throw JsonMappingException.from( jsonParser, "Could not parse zoned date time: " + string, e ); } }
ZonedDateTimeDeserializer extends StdDeserializer<ZonedDateTime> { @Override public ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException { final String string = jsonParser.getText().trim(); if ( string.isEmpty() ) { return null; } try { if ( DateTimeUtils.containsDateTimeOffset( string ) ) { return ZonedDateTime.parse( string, DateTimeFormatter.ISO_DATE_TIME ); } else { return ZonedDateTime.of( LocalDateTime.parse( string, DateTimeFormatter.ISO_LOCAL_DATE_TIME ), zoneId ); } } catch ( DateTimeParseException e ) { throw JsonMappingException.from( jsonParser, "Could not parse zoned date time: " + string, e ); } } }
ZonedDateTimeDeserializer extends StdDeserializer<ZonedDateTime> { @Override public ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException { final String string = jsonParser.getText().trim(); if ( string.isEmpty() ) { return null; } try { if ( DateTimeUtils.containsDateTimeOffset( string ) ) { return ZonedDateTime.parse( string, DateTimeFormatter.ISO_DATE_TIME ); } else { return ZonedDateTime.of( LocalDateTime.parse( string, DateTimeFormatter.ISO_LOCAL_DATE_TIME ), zoneId ); } } catch ( DateTimeParseException e ) { throw JsonMappingException.from( jsonParser, "Could not parse zoned date time: " + string, e ); } } ZonedDateTimeDeserializer(); }
ZonedDateTimeDeserializer extends StdDeserializer<ZonedDateTime> { @Override public ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException { final String string = jsonParser.getText().trim(); if ( string.isEmpty() ) { return null; } try { if ( DateTimeUtils.containsDateTimeOffset( string ) ) { return ZonedDateTime.parse( string, DateTimeFormatter.ISO_DATE_TIME ); } else { return ZonedDateTime.of( LocalDateTime.parse( string, DateTimeFormatter.ISO_LOCAL_DATE_TIME ), zoneId ); } } catch ( DateTimeParseException e ) { throw JsonMappingException.from( jsonParser, "Could not parse zoned date time: " + string, e ); } } ZonedDateTimeDeserializer(); @Override ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ); }
ZonedDateTimeDeserializer extends StdDeserializer<ZonedDateTime> { @Override public ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException { final String string = jsonParser.getText().trim(); if ( string.isEmpty() ) { return null; } try { if ( DateTimeUtils.containsDateTimeOffset( string ) ) { return ZonedDateTime.parse( string, DateTimeFormatter.ISO_DATE_TIME ); } else { return ZonedDateTime.of( LocalDateTime.parse( string, DateTimeFormatter.ISO_LOCAL_DATE_TIME ), zoneId ); } } catch ( DateTimeParseException e ) { throw JsonMappingException.from( jsonParser, "Could not parse zoned date time: " + string, e ); } } ZonedDateTimeDeserializer(); @Override ZonedDateTime deserialize( JsonParser jsonParser, DeserializationContext deserializationContext );  }