aboutsummaryrefslogtreecommitdiffstats
path: root/applications/guard/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'applications/guard/src/test')
-rw-r--r--applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/CoordinationTest.java4
-rw-r--r--applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequestTest.java10
2 files changed, 12 insertions, 2 deletions
diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/CoordinationTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/CoordinationTest.java
index b5585a7c..5b62f364 100644
--- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/CoordinationTest.java
+++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/CoordinationTest.java
@@ -23,6 +23,7 @@
package org.onap.policy.xacml.pdp.application.guard;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import com.att.research.xacml.api.Response;
import java.io.File;
@@ -191,7 +192,8 @@ public class CoordinationTest {
// the application.
//
CoordinationGuardTranslator translator = new CoordinationGuardTranslator();
- assertThat(translator.convertRequest(null)).isNull();
+ assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
+ translator.convertRequest(null)).withMessage("this convertRequest shouldn't be used");
assertThat(translator.convertResponse(null)).isNull();
assertThat(CoordinationGuardTranslator.loadCoordinationDirectiveFromFile(
policyFolder.getRoot().getAbsolutePath() + "/nonexist.yaml")).isNull();
diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequestTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequestTest.java
index b3ef3bdd..41fd4705 100644
--- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequestTest.java
+++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPolicyRequestTest.java
@@ -23,16 +23,18 @@
package org.onap.policy.xacml.pdp.application.guard;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
+import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionException;
public class GuardPolicyRequestTest {
@Test
- public void testAnomalies() {
+ public void testAnomalies() throws ToscaPolicyConversionException {
DecisionRequest decisionRequest = new DecisionRequest();
assertThat(GuardPolicyRequest.createInstance(decisionRequest)).isNotNull();
@@ -82,6 +84,12 @@ public class GuardPolicyRequestTest {
resources.put("guard", guard);
decisionRequest.setResource(resources);
assertThat(GuardPolicyRequest.createInstance(decisionRequest)).isNotNull();
+
+ guard.put("vfCount", "I am not valid");
+ resources.put("guard", guard);
+ decisionRequest.setResource(resources);
+ assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
+ GuardPolicyRequest.createInstance(decisionRequest));
}
}