summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaka Cho <takamune.cho@att.com>2020-07-06 12:02:45 -0400
committerTaka Cho <takamune.cho@att.com>2020-07-06 12:03:58 -0400
commitae5a28031340a46f2a99e2dbaea0fc00b25cd39e (patch)
treec527566f75f067947a5dbb2b7b18c93b1ae467c2
parent38f2ed14fdd23d4e696e3f4bf9e145b62e4e36ca (diff)
fix complete the assertion
add isInstanceOf for assertThatThrownBy. Issue-ID: POLICY-2616 Change-Id: If49255aec6004870d7d2acfeabe258def872c1fa Signed-off-by: Taka Cho <takamune.cho@att.com>
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java24
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/EventManagerServicesTest.java4
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);
}
Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
{
  "simulatorRequest": {
    "method": "GET",
    "path": "/aai/v../business/customers",
    "queryParams": {
      "subscriber-type": "INFRA",
      "depth": 0
    }
  } ,
  "simulatorResponse": {
    "responseCode": 200,
    "body": {
      "customer":[
        {
          "global-customer-id":"MSO_1610_ST",
          "subscriber-name":"MSO_1610_ST",
          "subscriber-type":"INFRA",
          "resource-version":"1494001902987"
        },
        {
          "global-customer-id":"21014aa2-526b-11e6-beb8-9e71128cae77",
          "subscriber-name":"PACKET CORE",
          "subscriber-type":"INFRA",
          "resource-version":"1494001776295"
        },
        {
          "global-customer-id":"DHV1707-TestSubscriber-2",
          "subscriber-name":"ICORE CORE",
          "subscriber-type":"INFRA",
          "resource-version":"1498751754450"
        },
        {
          "global-customer-id":"DHV1707-TestSubscriber-1",
          "subscriber-name":"PACKET1 CORE",
          "subscriber-type":"INFRA",
          "resource-version":"1498595633607"
        },
        {
          "global-customer-id":"jimmy-example",
          "subscriber-name":"JimmyExampleCust-20161102",
          "subscriber-type":"INFRA",
          "resource-version":"1494001970063"
        },
        {
          "global-customer-id":"jimmy-example2",
          "subscriber-name":"JimmyExampleCust-20161103",
          "subscriber-type":"INFRA",
          "resource-version":"1494001970225"
        },
        {
          "global-customer-id":"DHV1802-TestSub-PWT-102",
          "subscriber-name":"DHV1802-TestSub-PWT-102",
          "subscriber-type":"INFRA",
          "resource-version":"1508852495058"
        },
        {
          "global-customer-id":"DHV1802-TestSub-PWT-101",
          "subscriber-name":"DHV1802-TestSub-PWT-101",
          "subscriber-type":"INFRA",
          "resource-version":"1508179953733"
        },
        {
          "global-customer-id":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
          "subscriber-name":"Mobility",
          "subscriber-type":"INFRA",
          "resource-version":"1494001894192"
        },
        {
          "global-customer-id":"DHV1802-Subscriber-4",
          "subscriber-name":"DHV1802-Subscriber-5",
          "subscriber-type":"INFRA",
          "resource-version":"1509134064531"
        },
        {
          "global-customer-id":"DHV1802-TestSub-PWT-103",
          "subscriber-name":"DHV1802-TestSub-PWT-103",
          "subscriber-type":"INFRA",
          "resource-version":"1509045503736"
        },
        {
          "global-customer-id":"DHV1802-Subscriber-2",
          "subscriber-name":"DHV1802-Subscriber-2",
          "subscriber-type":"INFRA",
          "resource-version":"1509122065439"
        },
        {
          "global-customer-id":"e433710f-9217-458d-a79d-1c7aff376d89",
          "subscriber-name":"USP VOICE",
          "subscriber-type":"INFRA",
          "resource-version":"1494001938080"
        },
        {
          "global-customer-id":"DHV1802-Subscriber-3",
          "subscriber-name":"DHV1802-Subscriber-3",
          "subscriber-type":"INFRA",
          "resource-version":"1509122759407"
        },
        {
          "global-customer-id":"31739f3e-526b-11e6-beb8-9e71128cae77",
          "subscriber-name":"FIREWALL/MISC",
          "subscriber-type":"INFRA",
          "resource-version":"1494001772223"
        }
      ]
    }

  }
}