aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-executor-test
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-07-17 18:30:21 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-17 18:30:21 +0000
commit30e93de6d5feb9ebc29fbf911f1eb37bbf9962c2 (patch)
treef870a9b163d8b22899a717635a0ecd0e7c32af58 /testsuites/integration/integration-executor-test
parent3ff6447c92760883e53f5d6a2d7dc727ea486700 (diff)
parent4752a9ede61f2df4e67ec18f6c53cdcd0c35885f (diff)
Merge "Replace try/catch with assertj - apex-pdp"
Diffstat (limited to 'testsuites/integration/integration-executor-test')
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java18
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java20
2 files changed, 12 insertions, 26 deletions
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
index 5f89db675..bf883d761 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.testsuites.integration.executor.event;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -168,19 +169,10 @@ public class TestEventInstantiation {
value = event.get("TestMatchCase");
assertNull(value);
- try {
- event.put("TestMatchCase", "Hello");
- } catch (final Exception e) {
- assertEquals("Event0000:0.0.1:NULL:TestMatchCase: object \"Hello\" of class \"java.lang.String\" "
- + "not compatible with class \"java.lang.Byte\"", e.getMessage());
- }
-
- try {
- event.put("TestMatchCase", 123.45);
- } catch (final Exception e) {
- assertEquals("Event0000:0.0.1:NULL:TestMatchCase: object \"123.45\" of class \"java.lang.Double\" "
- + "not compatible with class \"java.lang.Byte\"", e.getMessage());
- }
+ assertThatThrownBy(() -> event.put("TestMatchCase", "Hello"))
+ .hasMessage("Event0000:0.0.1:NULL:TestMatchCase: object \"Hello\" of class \"java.lang.String\" "
+ + "not compatible with class \"java.lang.Byte\"");
+ event.put("TestMatchCase", 123.45);
event.put("TestMatchCase", Byte.valueOf("16"));
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
index d73b51147..aaf640bb4 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -99,15 +100,8 @@ public class TestApexModelExport {
exportPolicyList.clear();
exportPolicyList.add(new AxArtifactKey("NonExistentPolicy", "0.0.1"));
- try {
- final AxPolicyModel emptyExportedModel = PolicyModelSplitter.getSubPolicyModel(model, exportPolicyList);
- assertNotNull(emptyExportedModel);
- } catch (final Exception e) {
- assertTrue(e.getMessage()
- .equals("new model is invalid:\n" + "***validation of model failed***\n"
- + "AxPolicies:Policies:0.0.1 - policyMap may not be null or empty\n"
- + "AxEvents:Events:0.0.1 - eventMap may not be null or empty\n"
- + "********************************"));
- }
+ final AxPolicyModel emptyExportedModel = PolicyModelSplitter.getSubPolicyModel(model, exportPolicyList);
+ assertNotNull(emptyExportedModel);
+
}
}