#653 - Change format of all Timestamp/Date time types to use epoch millis

This commit is contained in:
Robin Bygrave
2016-04-18 12:49:16 +12:00
parent 2de78cd20f
commit 658ce3c5d3
2 changed files with 30 additions and 5 deletions
@@ -69,11 +69,20 @@ public class ScalarTypeInstantTest {
Instant now = Instant.now();
Timestamp timestamp = Timestamp.from(now);
String formatted = type.formatValue(now);
assertEquals(timestamp.toString(), formatted);
assertEquals(""+timestamp.getTime(), formatted);
}
@Test
public void testParse() throws Exception {
public void testParse_when_epochMillis() throws Exception {
Instant now = Instant.now();
Timestamp timestamp = Timestamp.from(now);
Instant val1 = type.parse(""+timestamp.getTime());
assertEquals(now, val1);
}
@Test
public void testParse_when_timestampForm() throws Exception {
Instant now = Instant.now();
Timestamp timestamp = Timestamp.from(now);
@@ -81,6 +90,16 @@ public class ScalarTypeInstantTest {
assertEquals(now, val1);
}
@Test
public void testFormatAndParse() throws Exception {
Instant now = Instant.now();
String format = type.format(now);
Instant val1 = type.parse(format);
assertEquals(now, val1);
}
@Test
public void testIsDateTimeCapable() throws Exception {