NIFI-3718: Fixed TestAvroRecordReader to handle timezone differences

This closes #1683
This commit is contained in:
Matt Burgess 2017-04-19 16:17:35 -04:00
parent b93cf7bbdb
commit 141334c3c9
1 changed files with 4 additions and 2 deletions

View File

@ -83,7 +83,7 @@ public class TestAvroRecordReader {
record.put("timeMicros", millisSinceMidnight * 1000L);
record.put("timestampMillis", timeLong);
record.put("timestampMicros", timeLong * 1000L);
record.put("date", 17261);
record.put("date", 17260);
writer.append(record);
writer.flush();
@ -106,7 +106,9 @@ public class TestAvroRecordReader {
assertEquals(new java.sql.Time(millisSinceMidnight), record.getValue("timeMicros"));
assertEquals(new java.sql.Timestamp(timeLong), record.getValue("timestampMillis"));
assertEquals(new java.sql.Timestamp(timeLong), record.getValue("timestampMicros"));
assertEquals(new java.sql.Date(timeLong).toString(), record.getValue("date").toString());
final DateFormat noTimeOfDayDateFormat = new SimpleDateFormat("yyyy-MM-dd");
noTimeOfDayDateFormat.setTimeZone(TimeZone.getTimeZone("gmt"));
assertEquals(new java.sql.Date(timeLong).toString(), noTimeOfDayDateFormat.format(record.getValue("date")));
}
}