aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-07-24 17:19:34 +0530
committerTakamune Cho <tc012c@att.com>2018-07-25 13:42:57 +0000
commit4ff6f2a5d19852018c718ea431baf6d1dedda051 (patch)
tree65c5b111c5b1253c63ac46ccb57318ee023e67d9
parent54fbdf069a4291cda4f0f36fa5319bb1ad04bb62 (diff)
added some more test cases to TimeTest.java
added some more test cases to increase code coverage Issue-ID: APPC-1086 Change-Id: I8f4458ddcc70d360eae71e41d1608d0529ed2269 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r--appc-common/src/test/java/org/onap/appc/util/TimeTest.java31
1 files changed, 26 insertions, 5 deletions
diff --git a/appc-common/src/test/java/org/onap/appc/util/TimeTest.java b/appc-common/src/test/java/org/onap/appc/util/TimeTest.java
index aef02a293..6aaeb5899 100644
--- a/appc-common/src/test/java/org/onap/appc/util/TimeTest.java
+++ b/appc-common/src/test/java/org/onap/appc/util/TimeTest.java
@@ -25,11 +25,9 @@
package org.onap.appc.util;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
+import java.text.ParseException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Calendar;
@@ -37,6 +35,10 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+
public class TimeTest {
@@ -113,7 +115,7 @@ public class TimeTest {
@Test
public void testSetDate() {
- Calendar cal = Calendar.getInstance();
+ Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2018);
cal.set(Calendar.MONTH, 07);
cal.set(Calendar.DAY_OF_MONTH, 03);
@@ -123,6 +125,25 @@ public class TimeTest {
@Test
public void testStartOfDayLocal() {
- assertTrue(Time.startOfDayLocal() instanceof Date);
+ assertTrue(Time.startOfDayLocal() instanceof Date);
+ }
+
+ @Test
+ public void testTimeStamp() {
+ assertTrue(Time.timestamp() instanceof XMLGregorianCalendar);
+ }
+
+ @Test
+ public void testDateToStringConverterMillis() {
+ String dateString=Time.dateToStringConverterMillis(new Date("02/09/2004"));
+ String expected="2004-02-09 00:00:00:000";
+ assertEquals(expected, dateString);
+ }
+
+ @Test
+ public void testStringToDateConverterMillis() throws ParseException{
+ Date date=Time.stringToDateConverterMillis("2004-02-09 00:00:00:000");
+ Date expected=new Date("02/09/2004");
+ assertEquals(expected, date);
}
}