mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#653 - Change format of all Timestamp/Date time types to use epoch millis
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user