diff options
Diffstat (limited to 'appc-core')
-rw-r--r-- | appc-core/appc-common-bundle/src/test/java/org/onap/appc/util/TimeTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/appc-core/appc-common-bundle/src/test/java/org/onap/appc/util/TimeTest.java b/appc-core/appc-common-bundle/src/test/java/org/onap/appc/util/TimeTest.java index 961a62c0a..3a73d7a2c 100644 --- a/appc-core/appc-common-bundle/src/test/java/org/onap/appc/util/TimeTest.java +++ b/appc-core/appc-common-bundle/src/test/java/org/onap/appc/util/TimeTest.java @@ -33,9 +33,12 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import org.junit.Test; @@ -147,4 +150,22 @@ public class TimeTest { Date expected=new Date("02/09/2004"); assertEquals(expected, date); } + + @Test + public void testTruncateDate() throws ParseException{ + Date date=Time.truncDate(new Date("02/09/2004")); + Date expected=new Date("02/09/2004"); + assertEquals(expected, date); + } + + @Test + public void testToDate() throws ParseException, DatatypeConfigurationException{ + Date date=new Date("02/09/2004"); + GregorianCalendar c = new GregorianCalendar(); + c.setTime(date); + XMLGregorianCalendar calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + Date actual= Time.toDate(calendar); + Date expected=new Date("02/09/2004"); + assertEquals(expected, actual); + } } |