aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-29 14:13:14 -0400
committerJim Hahn <jrh3@att.com>2020-06-29 14:58:33 -0400
commit05506483dff28c491522beeaaea0f6904077e3ed (patch)
tree9146aba8b5f48b693d02ac1846b98e617931bc93 /main/src/test/java
parentf92147f681bac8292021028d88c913ff977dd594 (diff)
Fix issues in xacml-pdp for new sonar rules
Addressed issues reported due to updates to the sonar rules: - invoke only one method in a junit lambda - complete the assertion - use assertThat().exists(), canRead(), etc. Issue-ID: POLICY-2681 Change-Id: I2935f4d0295244ab3b11a57a3bc401c64b695fd1 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test/java')
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java8
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java1
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java1
3 files changed, 4 insertions, 6 deletions
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java
index 243c9eab..2a85579c 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java
@@ -95,7 +95,7 @@ public class XacmlPdpApplicationManagerTest {
// We need at least 1 policies
//
assertThat(completedJtst).isNotNull();
- assertThat(completedJtst.getToscaTopologyTemplate().getPolicies().size()).isGreaterThan(0);
+ assertThat(completedJtst.getToscaTopologyTemplate().getPolicies().size()).isPositive();
//
// Copy test directory over of the application directories
//
@@ -141,7 +141,7 @@ public class XacmlPdpApplicationManagerTest {
// Test the basics from the startup
//
assertThat(manager).isNotNull();
- assertThat(manager.getPolicyCount()).isEqualTo(0);
+ assertThat(manager.getPolicyCount()).isZero();
assertThat(manager.getPolicyTypeCount()).isEqualTo(19);
assertThat(manager.getToscaPolicies()).isEmpty();
assertThat(manager.getToscaPolicyIdentifiers()).isEmpty();
@@ -172,11 +172,11 @@ public class XacmlPdpApplicationManagerTest {
final ToscaPolicy policyFinal = policy;
assertThatCode(() -> {
manager.removeUndeployedPolicy(policyFinal);
- assertThat(manager.getPolicyCount()).isEqualTo(0);
+ assertThat(manager.getPolicyCount()).isZero();
manager.loadDeployedPolicy(policyFinal);
assertThat(manager.getPolicyCount()).isEqualTo(1);
manager.removeUndeployedPolicy(policyFinal);
- assertThat(manager.getPolicyCount()).isEqualTo(0);
+ assertThat(manager.getPolicyCount()).isZero();
}).doesNotThrowAnyException();
//
// try loading something unsupported
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java
index 0b77650c..1dbbff9d 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java
@@ -22,7 +22,6 @@ package org.onap.policy.pdpx.main.rest.serialization;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import com.att.research.xacml.api.Request;
import com.att.research.xacml.api.RequestAttributes;
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java
index ba2bd780..f2e4f4f6 100644
--- a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java
+++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java
@@ -22,7 +22,6 @@ package org.onap.policy.pdpx.main.rest.serialization;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import com.att.research.xacml.api.Request;
import com.att.research.xacml.api.RequestAttributes;