summaryrefslogtreecommitdiffstats
path: root/integrity-monitor
diff options
context:
space:
mode:
Diffstat (limited to 'integrity-monitor')
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java19
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java20
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java12
3 files changed, 26 insertions, 25 deletions
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
index 79cfe549..a46be4f0 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -177,16 +177,19 @@ public class AllSeemsWellTest extends IntegrityMonitorTestBase {
}
// Check for null parameters
- assertThatThrownBy(() -> im.allSeemsWell(null, IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell(null, IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
- assertThatThrownBy(() -> im.allSeemsWell("", IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell("", IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
- assertThatThrownBy(() -> im.allSeemsWell(this.getClass().getName(), null, ALL_SEEMS_WELL_MSG));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell(this.getClass().getName(), null, ALL_SEEMS_WELL_MSG));
- assertThatThrownBy(() -> im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL,
- null));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, null));
- assertThatThrownBy(
+ assertThatIllegalArgumentException().isThrownBy(
() -> im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, ""));
logger.debug("\n\ntestAllSeemsWell: Exit\n\n");
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
index 1e194c3b..0def27e0 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -192,7 +192,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
waitCycles(DEPENDENCY_CHECK_CYCLES);
final IntegrityMonitor im2 = im;
- assertThatThrownBy(im2::evaluateSanity);
+ assertThatThrownBy(im2::evaluateSanity).isInstanceOf(IntegrityMonitorException.class);
// undo dependency groups and jmx test properties settings
myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
@@ -313,7 +313,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
assertEquals(StateManagement.LOCKED, sm.getAdminState());
// test startTransaction. It should fail since it is locked
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.unlock();
logger.debug("\n\nsm.unlock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
@@ -374,7 +374,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
assertEquals(StateManagement.HOT_STANDBY, sm.getStandbyStatus());
// test startTransaction. It should fail since it is standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.promote();
@@ -400,7 +400,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
// Test startTransaction. Should fail since standby status is cold
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.enableNoDependency();
@@ -410,7 +410,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
assertEquals(StateManagement.FAILED, sm.getAvailStatus());
// Test startTransaction. Should fail since standby status is cold
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.disableDependency();
sm.enableNotFailed();
@@ -423,7 +423,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
assertEquals(StateManagement.DEPENDENCY, sm.getAvailStatus());
// Test startTransaction. Should fail since standby status is cold
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.enableNoDependency();
logger.debug(
@@ -432,7 +432,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
assertEquals(StateManagement.ENABLED, sm.getOpState());
// test startTransaction. It should fail since standby status is hot
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
logger.debug("\n\ntestIM: Exit\n\n");
}
@@ -490,7 +490,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
// to do it.
logger.debug("\n\nIntegrityMonitor.testSanityState: calling im.dependencyCheck()\n\n");
im.dependencyCheck();
- assertThatThrownBy(im::evaluateSanity);
+ assertThatThrownBy(im::evaluateSanity).isInstanceOf(IntegrityMonitorException.class);
logger.debug("\n\ntestSanityState: Exit\n\n");
}
@@ -648,7 +648,7 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase {
*/
waitCycles(DEPENDENCY_CHECK_CYCLES);
- assertThatThrownBy(im::evaluateSanity);
+ assertThatThrownBy(im::evaluateSanity).isInstanceOf(IntegrityMonitorException.class);
logger.debug("\n\ntestStateCheck: Exit\n\n");
}
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) {