aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-29 10:16:44 -0400
committerJim Hahn <jrh3@att.com>2020-06-29 11:09:58 -0400
commitff0842117fba4dfe675a8b87af3a1098cde023bd (patch)
tree1dde66fc3323e9bb3edec8bf83df1456cbf6fffd /integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
parent4cdfdf4fa218a3b4f7e9690355db85976bc1888d (diff)
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 <jrh3@att.com>
Diffstat (limited to 'integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java')
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java12
1 files changed, 5 insertions, 7 deletions
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) {