From bbb9002a161b2513e8c543f824de796f1fdfa465 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Fri, 20 Jul 2018 17:05:39 +0530 Subject: added few more test cases to TimeTest.java added few more test cases to TimeTest.java to increase code coverage Issue-ID: APPC-1086 Change-Id: I910a5ab4420cc38d9c27fc2a206ac96b5377e225 Signed-off-by: Sandeep J --- .../src/test/java/org/onap/appc/util/TimeTest.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'appc-common') 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 8bf04a0c6..aef02a293 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 @@ -97,4 +97,32 @@ public class TimeTest { String expected="19 juil. 2018 00:00:00"; assertEquals(expected,Time.getDateByLocaleAndTimeZone(dateNow,locale,timeZone)); } + + @Test + public void testUtcFormat() { + final Date date = new Date("19-Jul-2018"); + String expected="07/19/2018 00:00:00"; + assertEquals(expected,Time.utcFormat(date)); + } + + @Test + public void testLocalTime() { + long expected=1532083631; + assertEquals(expected,Time.localTime(1532083631)); + } + + @Test + public void testSetDate() { + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, 2018); + cal.set(Calendar.MONTH, 07); + cal.set(Calendar.DAY_OF_MONTH, 03); + Calendar cal1= Time.setDate(cal, 2018, 07, 03); + assertEquals(cal, cal1); + } + + @Test + public void testStartOfDayLocal() { + assertTrue(Time.startOfDayLocal() instanceof Date); + } } -- cgit 1.2.3-korg