aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-executor-test/src
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2020-07-07 17:51:42 +0100
committerwaynedunican <wayne.dunican@est.tech>2020-07-17 09:44:03 +0100
commit4752a9ede61f2df4e67ec18f6c53cdcd0c35885f (patch)
tree29374ab930d63747cd9fff119d598184930a056d /testsuites/integration/integration-executor-test/src
parent28eced32d2acdf731f7782e14f37bf2ea8c98019 (diff)
Replace try/catch with assertj - apex-pdp
Replaced try/catch blocks in apex-pdp with assertj assertions. Part II of changes Issue-ID: POLICY-2451 Change-Id: I29823054fbeb6d1a287d1234859aaf2d4609ef6d Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'testsuites/integration/integration-executor-test/src')
-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);
+
}
}