### Question:
MessageSourceDateFormatter implements Formatter<Date> { @Override public Date parse(String text, Locale locale) throws ParseException { final SimpleDateFormat format = getDateFormat(locale); return format.parse(text); } MessageSourceDateFormatter(String messageKey); @Override String print(Date object, Locale locale); @Override Date parse(String text, Locale locale);  }### Answer:
@Test public void testParse() throws Exception { final String testDateAsString = "30.06.2015"; final Date result = testeeWithValidKey.parse(testDateAsString, Locale.GERMAN); assertThat(result).isEqualTo(germanDateFormat.parse(testDateAsString)); }
@Test public void testParseDefaultFormat() throws Exception { final String testDateAsString = "2015-06-30"; final Date result = testeeWithInvalidKey.parse(testDateAsString, Locale.GERMAN); assertThat(result).isEqualTo(defaultDateFormat.parse(testDateAsString)); }