GeneralizedTimeValueTranscoder extends AbstractStringValueTranscoder<ZonedDateTime> { @Override public ZonedDateTime decodeStringValue(final String value) { try { return parseGeneralizedTime(value); } catch (ParseException | DateTimeException e) { throw new IllegalArgumentException(e); } }  @Override ZonedDateTime decodeStringValue(final String value); @Override String encodeStringValue(final ZonedDateTime value); @Override Class<ZonedDateTime> getType();  }
@Test(groups = "transcode", dataProvider = "dates") public void decodeGeneralized(final ZonedDateTime date, final String generalizedTime, final String formatTime) throws Exception { Assert.assertEquals(transcoder.decodeStringValue(generalizedTime), date); }
@Test(groups = "transcode", dataProvider = "dates") public void decodeFormat(final ZonedDateTime date, final String generalizedTime, final String formatTime) throws Exception { Assert.assertEquals(transcoder.decodeStringValue(formatTime), date.withZoneSameInstant(ZoneOffset.UTC)); }
@Test(groups = "transcode", dataProvider = "invalid") public void testInvalid(final String generalizedTime) throws Exception { try { transcoder.decodeStringValue(generalizedTime); Assert.fail("Should have thrown exception"); } catch (Exception e) { Assert.assertEquals(e.getClass(), IllegalArgumentException.class); } }