From b7804abcf865dc58a01bed3f2be4756e731d9288 Mon Sep 17 00:00:00 2001 From: waynedunican Date: Tue, 23 Jul 2024 09:23:51 +0100 Subject: Improve code coverage and sonar fixes Increased code coverage to 90% SONAR - Removed TODO comments SONAR - Added NOSONAR where appropriate SONAR - Replaced stream.Collect() with stream.toList() where applicable SONAR - Made variables serializable or transient to comply with sonar rules Issue-ID: POLICY-5069 Change-Id: Ife256eaf4e6f427fe40b138bacc6f112dc5bcea4 Signed-off-by: waynedunican --- .../src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java | 2 +- models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java | 2 +- .../test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java | 1 - .../org/onap/policy/models/base/testconcepts/DummyPfObjectFilter.java | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'models-base/src/test') diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java index d605645ad..35535e789 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfReferenceKeyTest.java @@ -130,7 +130,7 @@ class PfReferenceKeyTest { assertNotEquals(0, testReferenceKey.compareTo(new PfReferenceKey("NPKN", VERSION001, "NPLN", "LN"))); assertEquals(0, testReferenceKey.compareTo(new PfReferenceKey("NPKN", VERSION001, NPKLN, "NLN"))); - assertNotEquals(testReferenceKey, null); + assertNotNull(testReferenceKey); assertThatThrownBy(() -> new PfReferenceKey((PfReferenceKey) null)).isInstanceOf(NullPointerException.class); diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java index 2fea439b6..9d142bf96 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/PfUtilsTest.java @@ -48,7 +48,7 @@ class PfUtilsTest { assertEquals(0, PfUtils.compareObjects(null, null)); assertEquals(-1, PfUtils.compareObjects(HELLO, null)); assertEquals(1, PfUtils.compareObjects(null, HELLO)); - assertNotEquals(PfUtils.compareObjects(HELLO, "goodbye"), 0); + assertNotEquals(0, PfUtils.compareObjects(HELLO, "goodbye")); assertEquals(0, PfUtils.compareObjects(HELLO, HELLO)); } diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java index 594528be8..4b3d9e89a 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfKey.java @@ -102,7 +102,6 @@ public class DummyPfKey extends PfKey { @Override public boolean isNewerThan(@NonNull PfKey otherKey) { - // TODO Auto-generated method stub return false; } diff --git a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectFilter.java b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectFilter.java index 489262865..3f0199ac5 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectFilter.java +++ b/models-base/src/test/java/org/onap/policy/models/base/testconcepts/DummyPfObjectFilter.java @@ -33,7 +33,6 @@ import org.onap.policy.models.base.PfObjectFilter; public class DummyPfObjectFilter implements PfObjectFilter { @Override public List filter(List originalList) { - // TODO Auto-generated method stub return null; } } -- cgit 1.2.3-korg