summaryrefslogtreecommitdiffstats
path: root/appc-common
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-07-19 14:55:11 +0530
committerPatrick Brady <pb071s@att.com>2018-07-19 20:24:10 +0000
commit13591a022d59d11d1301c459ab66b8e2abb8ac47 (patch)
tree09c758917657996165aa6435f143934dc9d9999a /appc-common
parentb493b1ac7b495cca73f864a4f9835b1a910ac2f1 (diff)
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 <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-common')
-rw-r--r--appc-common/src/test/java/org/onap/appc/util/TimeTest.java27
1 files changed, 24 insertions, 3 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 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));
+ }
}