diff options
Diffstat (limited to 'controlloop')
2 files changed, 19 insertions, 9 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java index d09c2c88b..86381ebec 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java @@ -47,6 +47,7 @@ import java.util.function.Consumer; import org.drools.core.WorkingMemory; import org.junit.Before; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.kie.api.runtime.rule.FactHandle; import org.mockito.ArgumentCaptor; import org.mockito.Mock; @@ -199,7 +200,8 @@ public class ControlLoopEventManager2Test { // invalid event.setTarget("unknown-target"); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(ControlLoopException.class); } /** @@ -602,13 +604,16 @@ public class ControlLoopEventManager2Test { Map<String, String> orig = event.getAai(); event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "true")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(IllegalStateException.class); event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_IS_CLOSED_LOOP_DISABLED, "true")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(IllegalStateException.class); event.setAai(addAai(orig, ControlLoopEventManager2.PNF_IS_IN_MAINT, "true")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(IllegalStateException.class); } private Map<String, String> addAai(Map<String, String> original, String key, String value) { @@ -625,13 +630,15 @@ public class ControlLoopEventManager2Test { assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException(); event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "inactive")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(IllegalStateException.class); event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE")); assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException(); - + event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "inactive")); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(IllegalStateException.class); } @Test @@ -640,7 +647,8 @@ public class ControlLoopEventManager2Test { for (String value : Arrays.asList("yes", "y", "true", "t", "yEs", "trUe")) { event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, value)); - assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)); + assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem)) + .isInstanceOf(IllegalStateException.class); } event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_IS_CLOSED_LOOP_DISABLED, "false")); diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/EventManagerServicesTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/EventManagerServicesTest.java index ea3fff311..13ad56259 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/EventManagerServicesTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/EventManagerServicesTest.java @@ -33,6 +33,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.controlloop.actorserviceprovider.ActorService; import org.onap.policy.controlloop.ophistory.OperationHistoryDataManagerImpl; @@ -109,7 +110,8 @@ public class EventManagerServicesTest { @Test public void testMakeDataManager() { - assertThatThrownBy(() -> new EventManagerServices(FILEPFX + "event-svc-invalid-db")); + assertThatThrownBy(() -> new EventManagerServices(FILEPFX + "event-svc-invalid-db")) + .isInstanceOf(IllegalArgumentException.class); } |