aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src/test/java/org/onap
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2024-07-23 09:23:51 +0100
committerwaynedunican <wayne.dunican@est.tech>2024-08-13 08:49:10 +0100
commitb7804abcf865dc58a01bed3f2be4756e731d9288 (patch)
tree7f6fc3b50622578bb8612de9fe5e5c6adddfaf28 /models-pdp/src/test/java/org/onap
parenta029ccab07f2dd71286804da620c513da9fdfc0e (diff)
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 <wayne.dunican@est.tech>
Diffstat (limited to 'models-pdp/src/test/java/org/onap')
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java4
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java4
2 files changed, 3 insertions, 5 deletions
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
index 998ccf6af..acf1f6053 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpFilterParametersTest.java
@@ -33,9 +33,9 @@ class PdpFilterParametersTest {
@Test
void testGetFilterMap() {
- assertThat(PdpFilterParameters.builder().build().getFilterMap()).isNull();
+ assertThat(PdpFilterParameters.builder().build().getFilterMap()).isEmpty();
- assertThat(PdpFilterParameters.builder().subGroup(SUBGROUP).build().getFilterMap()).isNull();
+ assertThat(PdpFilterParameters.builder().subGroup(SUBGROUP).build().getFilterMap()).isEmpty();
PdpFilterParameters params = PdpFilterParameters.builder().group(GROUP).build();
Map<String, Object> map = params.getFilterMap();
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
index 85d68ae80..15ea29d94 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
@@ -38,7 +38,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.base.Validated;
import org.onap.policy.models.dao.DaoParameters;
@@ -66,7 +65,6 @@ import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider;
*/
class PdpProviderTest {
private static final String PDP_GROUPS0_JSON = "testdata/PdpGroups0.json";
- private static final String PDP_TYPE_IS_NULL = "pdpType is marked .*ull but is null";
private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked .*ull but is null";
private static final String GROUP_IS_NULL = "pdpGroupName is marked .*ull but is null";
private static final String DAO_IS_NULL = "dao is marked .*ull but is null";
@@ -594,7 +592,7 @@ class PdpProviderTest {
List<PdpPolicyStatus> records = prov.getGroupPolicyStatus(pfDao, GROUP_A);
assertThat(records).hasSize(2);
- Collections.sort(records, (rec1, rec2) -> rec1.getPdpId().compareTo(rec2.getPdpId()));
+ records.sort((rec1, rec2) -> rec1.getPdpId().compareTo(rec2.getPdpId()));
assertThat(records.get(0)).isEqualTo(idx);
assertThat(records.get(1)).isEqualTo(idy);