From 13591a022d59d11d1301c459ab66b8e2abb8ac47 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Thu, 19 Jul 2018 14:55:11 +0530 Subject: added few test cases to TimeTest.java added few test cases to increase code coverage Issue-ID: APPC-1086 Change-Id: Iab08ef3eef7fefab09a4389ffde8e0e1a4ca6025 Signed-off-by: Sandeep J --- .../src/test/java/org/onap/appc/util/TimeTest.java | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (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 ab01ad24b..8bf04a0c6 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 @@ -2,19 +2,22 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2018 + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * * ============LICENSE_END========================================================= */ @@ -22,6 +25,8 @@ 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; @@ -29,6 +34,8 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.Calendar; import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; public class TimeTest { @@ -76,4 +83,18 @@ public class TimeTest { assertEquals(epochSecs, utcSecs); } + @Test + public void testEndOfDayLocal() { + final Date dateNow = new Date(); + assertTrue(Time.endOfDayLocal(dateNow) instanceof Date); + } + + @Test + public void testGetDateByLocaleAndTimeZone() { + final Date dateNow = new Date("19-Jul-2018"); + Locale locale = new Locale("fr"); + TimeZone timeZone = TimeZone.getTimeZone("Europe/France"); + String expected="19 juil. 2018 00:00:00"; + assertEquals(expected,Time.getDateByLocaleAndTimeZone(dateNow,locale,timeZone)); + } } -- cgit 1.2.3-korg