added DATE14

This commit is contained in:
Jan Pomahac
2016-06-27 12:57:16 +02:00
parent 3a32b90414
commit 21d8824045
8 changed files with 127 additions and 4 deletions
@@ -61,4 +61,17 @@ public class TestDates {
Assert.assertEquals(comp.getValue().getTime(), bin.getValue().getTime());
}
@Test
public void testDate14FutureTolerance() throws ParseException, IOException {
Date soon = new Date(System.currentTimeMillis() + 50000);
byte[] buf = IsoType.DATE14.format(soon, null).getBytes();
IsoValue<Date> comp = new Date14ParseInfo().parse(0, buf, 0, null);
assert comp.getValue().after(new Date());
//Now with the binary
ByteArrayOutputStream bout = new ByteArrayOutputStream();
comp.write(bout, true, false);
IsoValue<Date> bin = new Date14ParseInfo().parseBinary(0, bout.toByteArray(), 0, null);
Assert.assertEquals(comp.getValue().getTime(), bin.getValue().getTime());
}
}