summaryrefslogtreecommitdiffstats
path: root/model/policy-model
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-07-23 13:40:28 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-23 13:40:28 +0000
commit7d640cc3ababa6d076878dcb75411fc7ffe4b4d0 (patch)
treeae3f325b080f2ae008ad44855655318681f453ce /model/policy-model
parent67ee67bd0da0d2d16abb982e26a3d48ba031a7e8 (diff)
parent1e80f98e25442b4badf570fd6ca652c21e499e28 (diff)
Merge "Remove try/catch blocks with assertj - apex-pdp"
Diffstat (limited to 'model/policy-model')
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java29
1 files changed, 7 insertions, 22 deletions
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java
index 655df059a..7961d8e8e 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/LogicTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.model.policymodel.concepts;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
@@ -103,21 +104,11 @@ public class LogicTest {
result = logic.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
- try {
- logic.setLogicFlavour(null);
- fail("test shold throw an exception here");
- } catch (final Exception e) {
- assertEquals("parameter \"logicFlavour\" is null", e.getMessage());
- }
-
- try {
- logic.setLogicFlavour("");
- fail("test shold throw an exception here");
- } catch (final Exception e) {
- assertEquals("parameter \"logicFlavour\": value \"\", "
- + "does not match regular expression \"[A-Za-z0-9\\-_]+\"", e.getMessage());
- }
-
+ assertThatThrownBy(() -> logic.setLogicFlavour(null))
+ .hasMessageContaining("parameter \"logicFlavour\" is null");
+ assertThatThrownBy(() -> logic.setLogicFlavour(""))
+ .hasMessage("parameter \"logicFlavour\": value \"\", "
+ + "does not match regular expression \"[A-Za-z0-9\\-_]+\"");
logic.setLogicFlavour(AxLogic.LOGIC_FLAVOUR_UNDEFINED);
result = new AxValidationResult();
result = logic.validate(result);
@@ -128,13 +119,7 @@ public class LogicTest {
result = logic.validate(result);
assertEquals(ValidationResult.VALID, result.getValidationResult());
- try {
- logic.setLogic(null);
- fail("test shold throw an exception here");
- } catch (final Exception e) {
- assertEquals("logic may not be null", e.getMessage());
- }
-
+ assertThatThrownBy(() -> logic.setLogic(null)).hasMessage("logic may not be null");
logic.setLogic("");
result = new AxValidationResult();
result = logic.validate(result);