aboutsummaryrefslogtreecommitdiffstats
path: root/model/policy-model/src
diff options
context:
space:
mode:
Diffstat (limited to 'model/policy-model/src')
-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);