NIFI-5890 Added a unit test that proves that 1.9 fixes a bug in the date conversion behavior in 1.8.

This closes #3214.

Signed-off-by: Koji Kawamura <ijokarumawak@apache.org>
This commit is contained in:
Mike Thomsen 2018-12-11 11:18:52 -05:00 committed by Koji Kawamura
parent 1a937b6511
commit 13a7f16860
1 changed files with 15 additions and 0 deletions

View File

@ -54,6 +54,21 @@ public class TestDataTypeUtils {
assertEquals("Times didn't match", ts.getTime(), sDate.getTime());
}
/*
* This was a bug in NiFi 1.8 where converting from a Timestamp to a Date with the record path API
* would throw an exception.
*/
@Test
public void testTimestampToDate() {
java.util.Date date = new java.util.Date();
Timestamp ts = DataTypeUtils.toTimestamp(date, null, null);
assertNotNull(ts);
java.sql.Date output = DataTypeUtils.toDate(ts, null, null);
assertNotNull(output);
assertEquals("Timestamps didn't match", output.getTime(), ts.getTime());
}
@Test
public void testConvertRecordMapToJavaMap() {
assertNull(DataTypeUtils.convertRecordMapToJavaMap(null, null));