diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-27 08:03:24 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-27 10:56:46 -0400 |
commit | 7da3ddfa40de2f683a2d423d62b78a8d001108eb (patch) | |
tree | 260fa9e903a3a6f2a60467bbeac500ad62d0e916 /utils-test/src | |
parent | dff3e8bb4ed367c05fb0425f03386994ed27d10a (diff) |
More sonar issues cleanup
Either log or rethrow
Use boolean expression
Add at least one test
Remove commented out code
Issue-ID: POLICY-2204
Change-Id: I4fdf31aea75303e4f49d25198eb3b12341995bfe
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'utils-test/src')
3 files changed, 7 insertions, 8 deletions
diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java b/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java index f52105ed..5002edfa 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/time/TestTimeMulti.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2020 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. @@ -29,7 +29,6 @@ import java.util.PriorityQueue; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import lombok.Getter; -import org.onap.policy.common.utils.time.TestTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -180,7 +179,7 @@ public class TestTimeMulti extends TestTime { long realEnd = System.currentTimeMillis() + maxWaitMs; while (System.currentTimeMillis() < realEnd) { - if (condition.call()) { + if (Boolean.TRUE.equals(condition.call())) { return; } diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/time/WorkItem.java b/utils-test/src/main/java/org/onap/policy/common/utils/time/WorkItem.java index af3d5d7e..cd690602 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/time/WorkItem.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/time/WorkItem.java @@ -1,8 +1,8 @@ -/* +/*-- * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -22,7 +22,6 @@ package org.onap.policy.common.utils.time; import lombok.AccessLevel; import lombok.Getter; -import org.onap.policy.common.utils.time.TestTime; /** * Work item to be executed at some time. diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/time/WorkItemTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/time/WorkItemTest.java index 4e6f92b5..d2fc8d58 100644 --- a/utils-test/src/test/java/org/onap/policy/common/utils/time/WorkItemTest.java +++ b/utils-test/src/test/java/org/onap/policy/common/utils/time/WorkItemTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -20,6 +20,7 @@ package org.onap.policy.common.utils.time; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -88,7 +89,7 @@ public class WorkItemTest { @Test public void testFire() { // ensure no exception is thrown - item.fire(); + assertThatCode(() -> item.fire()).doesNotThrowAnyException(); } @Test |