summaryrefslogtreecommitdiffstats
path: root/appc-core/appc-common-bundle
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-11-28 18:44:18 +0530
committerPatrick Brady <patrick.brady@att.com>2018-11-28 21:48:45 +0000
commit975556b8704e5ea2e3e509e2e2081774d17af48e (patch)
treef306386ac8c0222369a88f7bab5ed00b2e98241f /appc-core/appc-common-bundle
parent0b8421268aed54a7c0eabc461f81c52bc7f327d4 (diff)
added test cases to TimeTest.java
to increase code coverage Issue-ID: APPC-1086 Change-Id: I204a69f765356a4ea045793b0fefb69b68a406bf Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-core/appc-common-bundle')
-rw-r--r--appc-core/appc-common-bundle/src/test/java/org/onap/appc/util/TimeTest.java21
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);
+ }
}