aboutsummaryrefslogtreecommitdiffstats
path: root/models-base
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-04-09 11:55:57 +0000
committerliamfallon <liam.fallon@est.tech>2019-04-09 11:55:57 +0000
commit9ede89131044d171187c5be906aefee615a0e568 (patch)
treed77966aa7aa12ea520bacdbe835355ba20cccb65 /models-base
parentc54b9408a10c0060e35be2ee0b5bac6a24e9153a (diff)
Complete unit test for models-pdp
This review completes the unit test for the models-pdp module, for persistence of PDP groups and for PDP group filtering. Added unit test of filters for TOSCA policy types and policies. Added fix to allow filters to pass when the value being checked is null. Issue-ID: POLICY-1095 Change-Id: I982400ef39f0282d813d49e484a58207e03b8a63 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-base')
-rw-r--r--models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java4
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java8
2 files changed, 2 insertions, 10 deletions
diff --git a/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java b/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
index 501d9c353..10ce4ea60 100644
--- a/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
+++ b/models-base/src/main/java/org/onap/policy/models/base/PfObjectFilter.java
@@ -49,8 +49,8 @@ public interface PfObjectFilter<T extends Comparable<T>> {
* @param pattern the pattern to check against
* @return match or not
*/
- public default boolean filterString(@NonNull final String value, final String pattern) {
- return pattern == null || value.equals(pattern);
+ public default boolean filterString(final String value, final String pattern) {
+ return value == null || pattern == null || value.equals(pattern);
}
/**
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java
index 3d16f8e3f..c13140726 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfObjectFilterTest.java
@@ -84,14 +84,6 @@ public class PfObjectFilterTest {
assertFalse(dof.filterString("Hello", "Goodbye"));
assertTrue(dof.filterString("Hello", "Hello"));
- assertThatThrownBy(() -> {
- dof.filterString(null, null);
- }).hasMessage("value is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- dof.filterString(null, "hello");
- }).hasMessage("value is marked @NonNull but is null");
-
assertEquals(false, dof.filterString("Hello", "Goodbye"));
assertEquals(true, dof.filterString("Hello", "Hello"));
assertEquals(true, dof.filterString("Hello", null));