aboutsummaryrefslogtreecommitdiffstats
path: root/appc-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'appc-common/src')
-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));
+ }
}