FileInfo { String applyFormat(String dateString) { try { return DATE_TO_STRING.format(STRING_TO_DATE.parse(dateString)); }catch(Exception ignored){ return dateString; } } FileInfo();  FileInfo(String recordType, String tag, String date, String release, String recordCount); String getFormattedDate(); String getDate(); void setDate(String date); String getTag(); void setTag(String tag); String getRelease(); void setRelease(String release); String getRecordCount(); void setRecordCount(String recordCount); String getRecordType(); void setRecordType(String recordType); @Override String toString();  }
@Test public void testApplyFormat() { assertNull(this.fileInfo.applyFormat(null)); String badDate = "bad"; assertEquals(badDate,this.fileInfo.applyFormat(badDate)); assertEquals("2014-01-21",this.fileInfo.applyFormat("140121")); }