### Question:
ISO8601DateFormatter extends DateFormat { @Override public Date parse(String source, ParsePosition pos) { OffsetDateTime offsetDateTime = OffsetDateTime.parse(source, DateTimeFormatter.ISO_OFFSET_DATE_TIME); pos.setIndex(pos.getIndex() + source.length()); return Date.from(offsetDateTime.toInstant()); }  @Override StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition); @Override Date parse(String source, ParsePosition pos);  }### Answer:
@Test public void testParse() throws ParseException { Date now = new Date(); ISO8601DateFormatter iso8601DateFormatter = new ISO8601DateFormatter(); Date parsed = iso8601DateFormatter.parse(iso8601DateFormatter.format(now)); assertThat(parsed, is(now)); }