From ff0842117fba4dfe675a8b87af3a1098cde023bd Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 29 Jun 2020 10:16:44 -0400 Subject: Fix issues in common 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 - add DOCTYPE to html Issue-ID: POLICY-2650 Change-Id: Ib8b8a2e4736cc23849c0f7aef972ffa3365a3e00 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/common/im/StateManagementTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java') diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java index 680a73e6..12671ec3 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java @@ -113,19 +113,17 @@ public class StateManagementTest extends IntegrityMonitorTestBase { // the standbystatus shall transition to coldstandby and a // StandbyStatusException shall be thrown logger.info("\n??? promote() test case P4"); - assertThatThrownBy(() -> { - sm.disableFailed(); - sm.lock(); + sm.disableFailed(); + sm.lock(); + assertThatThrownBy(sm::promote).isInstanceOf(IntegrityMonitorException.class); - sm.promote(); - }); assertEquals(LOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(sm)); // P3 If promote() is called while standbyStatus is coldstandby, the // state shall not transition // and a StandbyStatusException shall be thrown logger.info("\n??? promote() test case P3"); - assertThatThrownBy(sm::promote); + assertThatThrownBy(sm::promote).isInstanceOf(IntegrityMonitorException.class); assertEquals(LOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(sm)); // P2 If promote() is called while the standbyStatus is null and the @@ -217,7 +215,7 @@ public class StateManagementTest extends IntegrityMonitorTestBase { assertEquals(UNLOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(stateChangeNotifier.getStateManagement())); logger.info("\n??? State change notification test case 6 - promote()"); - assertThatThrownBy(sm::promote); + assertThatThrownBy(sm::promote).isInstanceOf(IntegrityMonitorException.class); assertEquals(UNLOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(sm)); } catch (final Exception ex) { -- cgit 1.2.3-korg