From ccca53bbd25af1230e135587163bcb53e381058c Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 6 May 2021 17:32:21 -0400 Subject: Fix sonars in policy-pap Fixed: - use "var" instead of actual type - remove unused parameter - remove un-thrown exception from method declaration - call isPresent() before Optional.get() - check empty list before invoking doesNotContain() Issue-ID: POLICY-3285 Change-Id: Ic90dccfd591c102ce29f14084f025b3ca69587dc Signed-off-by: Jim Hahn --- .../java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java | 4 ++-- .../java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'main/src/test') diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java index 4a386c9c..0ceef772 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpHeartbeatListenerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2021 Nordix Foundation. - * Modifications Copyright (C) 2020 AT&T Intellectual Property. + * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -225,7 +225,7 @@ public class PdpHeartbeatListenerTest extends End2EndBase { PdpStatusMessageHandler handler = new PdpStatusMessageHandler(params); PdpUpdate update10 = handler.createPdpUpdateMessage( status3.getPdpGroup(), new PdpSubGroup(), "pdp_2", - null, policies, policies, polsUndep); + policies, policies, polsUndep); assertSame(update10.getPolicies(), policies); assertSame(update10.getPoliciesToBeDeployed(), policies); assertSame(update10.getPoliciesToBeUndeployed(), polsUndep); diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java index d85bf737..02f47287 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java @@ -236,10 +236,7 @@ public class UpdateReqTest extends CommonRequestBase { assertTrue(data.reconfigure(msg2)); - List dataPols = data.getMessage().getPoliciesToBeDeployed().stream() - .map(ToscaPolicy::getIdentifier) - .collect(Collectors.toList()); - assertThat(dataPols).doesNotContainAnyElementsOf(data.getMessage().getPoliciesToBeUndeployed()); + assertThat(data.getMessage().getPoliciesToBeDeployed()).isEmpty(); // some items only in deploy policies = new ArrayList<>(update.getPolicies()); -- cgit 1.2.3-korg