### Question:
MSEmailDecoder extends ActiveSyncDecoder implements IDataDecoder { @VisibleForTesting Date date(String dateAsString) throws ParseException { if (!Strings.isNullOrEmpty(dateAsString)) { return utcDateFormat.parse(dateAsString); } return null; } @Inject protected  MSEmailDecoder(MSMeetingRequestDecoder meetingRequestDecoder); @Override MSEmail decode(Element data);  }### Answer:
@Test(expected=ParseException.class) public void parseDateNeedsPunctuation() throws ParseException { decoder.date("20021126T160000Z"); }
@Test(expected=ParseException.class) public void parseDateNeedsTime() throws ParseException { decoder.date("2002-11-26"); }
@Test public void parseDateReturnNullAsItsOptionalWhenNull() throws ParseException { assertThat(decoder.date(null)).isNull(); }
@Test public void parseDateReturnNullAsItsOptionalWhenEmpty() throws ParseException { assertThat(decoder.date("")).isNull(); }
@Test public void parseDate() throws ParseException { Date parsed = decoder.date("2000-12-25T08:35:00.000Z"); assertThat(parsed).isEqualTo(date("2000-12-25T08:35:00+00")); }