@Test public void parseSecondsSinceDate(){ SecondsSinceDate sixties = (SecondsSinceDate)TypeUtil.parse(DataType.DATE_TIME_SECONDS_SINCE_1960, DATE_TIME); SecondsSinceDate seventies = (SecondsSinceDate)TypeUtil.parse(DataType.DATE_TIME_SECONDS_SINCE_1970, DATE_TIME); SecondsSinceDate eighties = (SecondsSinceDate)TypeUtil.parse(DataType.DATE_TIME_SECONDS_SINCE_1980, DATE_TIME); assertEquals(DataType.DATE_TIME_SECONDS_SINCE_1960, TypeUtil.getDataType(sixties)); assertEquals(DataType.DATE_TIME_SECONDS_SINCE_1970, TypeUtil.getDataType(seventies)); assertEquals(DataType.DATE_TIME_SECONDS_SINCE_1980, TypeUtil.getDataType(eighties)); assertEquals(10, ChronoUnit.YEARS.between(sixties.getEpoch(), seventies.getEpoch())); assertEquals(10, ChronoUnit.YEARS.between(seventies.getEpoch(), eighties.getEpoch())); try { int diff = (sixties).compareTo(seventies); fail(); } catch(ClassCastException cce){ } assertEquals(sixties, TypeUtil.cast(DataType.DATE_TIME_SECONDS_SINCE_1960, seventies)); assertEquals(sixties, TypeUtil.cast(DataType.DATE_TIME_SECONDS_SINCE_1960, eighties)); assertEquals(seventies, TypeUtil.cast(DataType.DATE_TIME_SECONDS_SINCE_1970, sixties)); assertEquals(seventies, TypeUtil.cast(DataType.DATE_TIME_SECONDS_SINCE_1970, eighties)); assertEquals(eighties, TypeUtil.cast(DataType.DATE_TIME_SECONDS_SINCE_1980, sixties)); assertEquals(eighties, TypeUtil.cast(DataType.DATE_TIME_SECONDS_SINCE_1980, seventies)); assertEquals(0L, countSecondsSince1960("1960-01-01T00:00:00")); assertEquals(1L, countSecondsSince1960("1960-01-01T00:00:01")); assertEquals(60L, countSecondsSince1960("1960-01-01T00:01:00")); assertEquals(-1L, countSecondsSince1960("1959-12-31T23:59:59")); assertEquals(185403L, countSecondsSince1960("1960-01-03T03:30:03")); }
static private SecondsSinceDate parseSecondsSinceDate(LocalDate epoch, String value){ return new SecondsSinceDate(epoch, parseDateTime(value)); }
TypeUtil { static private SecondsSinceDate parseSecondsSinceDate(LocalDate epoch, String value){ return new SecondsSinceDate(epoch, parseDateTime(value)); } }
TypeUtil { static private SecondsSinceDate parseSecondsSinceDate(LocalDate epoch, String value){ return new SecondsSinceDate(epoch, parseDateTime(value)); } private  TypeUtil(); }
TypeUtil { static private SecondsSinceDate parseSecondsSinceDate(LocalDate epoch, String value){ return new SecondsSinceDate(epoch, parseDateTime(value)); } private  TypeUtil(); static String format(Object value); static Object parseOrCast(DataType dataType, Object value); static Object parse(DataType dataType, String value); static DaysSinceDate parseDaysSinceDate(LocalDate epoch, String value); static boolean equals(DataType dataType, Object value, Object referenceValue); static DataType getDataType(Object value); static DataType getDataType(Collection<?> values); static DataType getCommonDataType(DataType left, DataType right); static OpType getOpType(DataType dataType); static Object cast(DataType dataType, Object value); static V cast(Class<? extends V> clazz, Object value); static DataType getConstantDataType(Object value); static DataType getConstantDataType(String value); }
TypeUtil { static private SecondsSinceDate parseSecondsSinceDate(LocalDate epoch, String value){ return new SecondsSinceDate(epoch, parseDateTime(value)); } private  TypeUtil(); static String format(Object value); static Object parseOrCast(DataType dataType, Object value); static Object parse(DataType dataType, String value); static DaysSinceDate parseDaysSinceDate(LocalDate epoch, String value); static boolean equals(DataType dataType, Object value, Object referenceValue); static DataType getDataType(Object value); static DataType getDataType(Collection<?> values); static DataType getCommonDataType(DataType left, DataType right); static OpType getOpType(DataType dataType); static Object cast(DataType dataType, Object value); static V cast(Class<? extends V> clazz, Object value); static DataType getConstantDataType(Object value); static DataType getConstantDataType(String value);  }