DateFormatterStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws Exception { Map<String, Object> contentMap = doc.getContentMap(); for (Entry<String, Object> contentField : contentMap.entrySet()) { if (dateFieldsSet.contains(contentField.getKey())) { if ((contentField.getValue() instanceof String)) { parseDate(contentField, doc); } } } }  @Override void init(); @Override void process(LocalDocument doc); void setDateFields(List<String> dateFields); void setEpochTimeZone(String epochTimeZone);  }
@Test public void testFromEpochToZuluDate_withUTC() throws Exception, IllegalArgumentException, IllegalAccessException, RequiredArgumentMissingException { String epochTest = "1377174053"; String expected = "2013-08-22T12:20:53Z"; setupStage(); LocalDocument ld = new LocalDocument(); ld.putContentField("date", epochTest); subject.process(ld); assertEquals(expected, ld.getContentField("date")); }
@Test public void testISO8601FormatToZuluDate() throws IllegalArgumentException, IllegalAccessException, Exception, RequiredArgumentMissingException { String iso8601 = "2012-06-29T10:42:53+02:00"; String expected = "2012-06-29T08:42:53Z"; setupStage(); LocalDocument ld = new LocalDocument(); ld.putContentField("date", iso8601); subject.process(ld); assertEquals(expected, ld.getContentField("date")); }