aboutsummaryrefslogtreecommitdiffstats
path: root/utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-02-13 16:16:45 -0500
committerJim Hahn <jrh3@att.com>2019-02-14 22:05:57 +0000
commitf10d38d4af0178d008c69ada7cd1a6abc6ec075a (patch)
treebc3923330a2dc4f9281157412038a09b5b68caba /utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java
parente4db2076fa2c7ce1763bfb0d70bd360bf57f6c99 (diff)
Sonar fixes
Added test for Serializer to increase junit coverage. Added tests for TestTimeMulti to increase junit coverage. Sonar fixes for PropertyConfiguration: - use equalsIgnoreCase - use the exception Updated license dates. Some fixes for LoggerFactoryWrapper to address sonar issue - utility classes should typically have a private constructor. Change-Id: I8957e9673fe8371ecca7abbb7ece87b0d6f46c1a Issue-ID: POLICY-1519 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java')
-rw-r--r--utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java
index 311e276d..f17235a2 100644
--- a/utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java
+++ b/utils-test/src/test/java/org/onap/policy/common/utils/time/TestTimeMultiTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Common Utils-Test
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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.
@@ -20,6 +20,7 @@
package org.onap.policy.common.utils.time;
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -72,6 +73,9 @@ public class TestTimeMultiTest {
}
assertTrue(ttm.getMillis() >= tbeg + NTIMES * MIN_SLEEP_MS);
+
+ // something in the queue, but no threads remain -> exception
+ assertThatIllegalStateException().isThrownBy(() -> ttm.threadCompleted());
}
private class MyThread extends Thread {
@@ -95,6 +99,13 @@ public class TestTimeMultiTest {
public void run() {
try {
for (int x = 0; x < NTIMES; ++x) {
+ // negative sleep should have no effect
+ texpected = ttm.getMillis();
+ ttm.sleep(-1);
+ if ((tactual = ttm.getMillis()) != texpected) {
+ break;
+ }
+
texpected = ttm.getMillis() + sleepMs;
ttm.sleep(sleepMs);