From 05506483dff28c491522beeaaea0f6904077e3ed Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 29 Jun 2020 14:13:14 -0400 Subject: 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 --- .../application/monitoring/MonitoringPdpApplicationTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'applications/monitoring/src') diff --git a/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java b/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java index bdb8a343..fd6711d4 100644 --- a/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java +++ b/applications/monitoring/src/test/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplicationTest.java @@ -172,7 +172,7 @@ public class MonitoringPdpApplicationTest { LOGGER.info("Decision {}", decision); assertThat(decision.getKey()).isNotNull(); - assertThat(decision.getKey().getPolicies()).hasSize(0); + assertThat(decision.getKey().getPolicies()).isEmpty(); // // Test the branch for query params, and we have no policy anyway // @@ -181,7 +181,7 @@ public class MonitoringPdpApplicationTest { LOGGER.info("Decision {}", decision); assertThat(decision.getKey()).isNotNull(); - assertThat(decision.getKey().getPolicies()).hasSize(0); + assertThat(decision.getKey().getPolicies()).isEmpty(); // // Test the branch for query params, and we have no policy anyway // @@ -190,7 +190,7 @@ public class MonitoringPdpApplicationTest { LOGGER.info("Decision {}", decision); assertThat(decision.getKey()).isNotNull(); - assertThat(decision.getKey().getPolicies()).hasSize(0); + assertThat(decision.getKey().getPolicies()).isEmpty(); } @SuppressWarnings("unchecked") @@ -244,8 +244,7 @@ public class MonitoringPdpApplicationTest { assertThat(decision.getKey()).isNotNull(); assertThat(decision.getKey().getPolicies()).hasSize(1); jsonPolicy = (Map) decision.getKey().getPolicies().get("onap.scaleout.tca"); - assertThat(jsonPolicy).isNotNull(); - assertThat(jsonPolicy).doesNotContainKey("properties"); + assertThat(jsonPolicy).isNotNull().doesNotContainKey("properties"); // // Don't Ask for abbreviated results // @@ -290,7 +289,7 @@ public class MonitoringPdpApplicationTest { LOGGER.info("Decision {}", decision.getKey()); assertThat(decision.getKey()).isNotNull(); - assertThat(decision.getKey().getPolicies()).hasSize(0); + assertThat(decision.getKey().getPolicies()).isEmpty(); } } -- cgit 1.2.3-korg