summaryrefslogtreecommitdiffstats
path: root/applications/native/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-27 15:10:18 -0400
committerJim Hahn <jrh3@att.com>2021-05-27 17:09:00 -0400
commitae9007f3554ba021d76d001ca555a13d49babc8d (patch)
treeddf359c36bfd60f49e55e25f91788c04ec99726d /applications/native/src/test
parentd1fa4ea52b243f60047a0bad5e63e947572b036b (diff)
Replace validation code with annotations
Instead of having code to validate various values, created POJOs to represent the decoded data so that bean validation annotations could be used instead. Didn't see any obvious ways to use annotations in the Optimization code, but did notice a bug (passed role instead of provisions). Extracted a common method which fixed the bug as a side-effect. Issue-ID: POLICY-2418 Change-Id: I9ef589086fc8f7f66810b66405fbf302d7570e5a Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'applications/native/src/test')
-rw-r--r--applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
index 3a405a89..83b65e5a 100644
--- a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
+++ b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
@@ -160,15 +160,15 @@ public class NativePdpApplicationTest {
if ("bad.base64".equals(policy.getName())) {
assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
translator.convertPolicy(policy)
- ).withMessageContaining("error on Base64 decoding the native policy");
+ ).as(policy.getName()).withMessageContaining("error on Base64 decoding the native policy");
} else if ("bad.noproperties".equals(policy.getName())) {
assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
translator.convertPolicy(policy)
- ).withMessageContaining("no xacml native policy found in the tosca policy");
+ ).as(policy.getName()).withMessageContaining("Cannot decode NativeDefinition from null properties");
} else if ("bad.policy".equals(policy.getName())) {
assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
translator.convertPolicy(policy)
- ).withMessageContaining("Invalid XACML Policy");
+ ).as(policy.getName()).withMessageContaining("Invalid XACML Policy");
}
}
}