### Question:
DateReportCellCSVExporter implements ReportCellCSVExporter { @Override public String getValue(Object result) { Resource resource = (Resource) result; Calendar cal = resource.getValueMap().get(property, Calendar.class); if (cal != null) { if (StringUtils.isNotBlank(format)) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(cal.getTime()); } else { return cal.getTime().toString(); } } else { return null; } }  @Override String getValue(Object result);  }### Answer:
@Test public void testExporter() throws IllegalAccessException{ log.info("testExporter"); DateReportCellCSVExporter exporter = new DateReportCellCSVExporter(); FieldUtils.writeField(exporter, "property", "now", true); FieldUtils.writeField(exporter, "format", FORMAT, true); String formattedDate = new SimpleDateFormat(FORMAT).format(start.getTime()); assertEquals(formattedDate, exporter.getValue(mockResource)); log.info("Test successful!"); }
@Test public void testNullProperty() throws IllegalAccessException{ log.info("testNullProperty"); DateReportCellCSVExporter exporter = new DateReportCellCSVExporter(); FieldUtils.writeField(exporter, "property", "someothertime", true); FieldUtils.writeField(exporter, "format", FORMAT, true); assertNull(exporter.getValue(mockResource)); log.info("Test successful!"); }
@Test public void testDefaultFormatting() throws IllegalAccessException{ log.info("testDefaultFormatting"); DateReportCellCSVExporter exporter = new DateReportCellCSVExporter(); FieldUtils.writeField(exporter, "property", "now", true); String formattedDate = start.getTime().toString(); assertEquals(formattedDate, exporter.getValue(mockResource)); log.info("Test successful!"); }