EdmDate extends SingletonPrimitiveType { public static EdmDate getInstance() { return INSTANCE; }  static EdmDate getInstance(); @Override Class<?> getDefaultType();  }
@Test public void valueToString() throws Exception { Calendar dateTime = Calendar.getInstance(); dateTime.clear(); setTimeZone(dateTime, "GMT-11:30"); dateTime.set(2012, 1, 29, 13, 0, 0); assertEquals("2012-02-29", instance.valueToString(dateTime, null, null, null, null, null)); Long millis = 1330558323007L; millis -= TimeZone.getDefault().getOffset(millis); assertEquals("2012-02-29", instance.valueToString(millis, null, null, null, null, null)); assertEquals("1969-12-31", instance.valueToString(new java.util.Date(-43200000), null, null, null, null, null)); assertEquals("1969-12-31", instance.valueToString(java.sql.Date.valueOf("1969-12-31"), null, null, null, null, null)); assertEquals("1969-12-31", instance.valueToString(LocalDate.parse("1969-12-31"), null, null, null, null, null)); expectTypeErrorInValueToString(instance, 0); }
@Test public void valueOfString() throws Exception { Calendar dateTime = Calendar.getInstance(); dateTime.clear(); dateTime.set(2012, 1, 29); assertEqualCalendar(dateTime, instance.valueOfString("2012-02-29", null, null, null, null, null, Calendar.class)); assertEquals(Long.valueOf(dateTime.getTimeInMillis()), instance.valueOfString("2012-02-29", null, null, null, null, null, Long.class)); assertEquals(dateTime.getTime(), instance.valueOfString("2012-02-29", null, null, null, null, null, java.util.Date.class)); assertEquals(java.sql.Date.valueOf("2012-02-29"), instance.valueOfString("2012-02-29", null, null, null, null, null, java.sql.Date.class)); assertEquals(LocalDate.parse("2012-02-29"), instance.valueOfString("2012-02-29", null, null, null, null, null, LocalDate.class)); expectContentErrorInValueOfString(instance, "2012-02-29T23:32:02"); expectContentErrorInValueOfString(instance, "2012-02-30"); expectContentErrorInValueOfString(instance, "20120229"); expectContentErrorInValueOfString(instance, "2012-02-1"); expectContentErrorInValueOfString(instance, "2012-2-12"); expectContentErrorInValueOfString(instance, "123-02-03"); expectTypeErrorInValueOfString(instance, "2012-02-29"); }