@Test public void dateParsingTest() throws Exception { final String s1 = f1.format(date); TimePositionType tp = new TimePositionType(s1); assertEquals(date, tp.getDate()); final String s2 = f2.format(date); tp = new TimePositionType(s2); assertEquals(date, tp.getDate()); final String s3 = f3.format(date); tp = new TimePositionType(s3); final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); final Date dateNoTime = cal.getTime(); assertEquals(dateNoTime, tp.getDate()); }
@Test public void setValueTest() throws Exception { String s = null; TimePositionType tp = new TimePositionType(s); final Date d = f3.parse("2010-01-01"); tp.setValue(d); assertEquals(tp.getValues(), Arrays.asList("2010-01-01")); final Date d2 = f2.parse("2010-01-01 01:01:02"); tp.setValue(d2); assertEquals(tp.getValues(), Arrays.asList("2010-01-01T01:01:02.00")); }