aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-04-12 15:53:08 -0400
committerJim Hahn <jrh3@att.com>2019-04-12 21:42:16 -0400
commitc38fcf1a16f0d6bfdf2d80efa64a94ae68d80f03 (patch)
tree5a4d88b12586e8d70b1055d40786d6dd0e0e82d5 /models-pdp/src/test
parentb2ae3e6a44a3aa70ac1cd1d2ef78316bfc6e9d04 (diff)
Check for duplicates in lists
Modified duplicate subgroup check to eliminate sonar issue. Added duplicate group check. Modified ModelsTest to exclude PdpMessage, which seemed to cause intermittent junit failures. Change-Id: Id281874506d3a39610739e24cee49360b345724f Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-pdp/src/test')
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java6
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java5
2 files changed, 10 insertions, 1 deletions
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
index 7a6c03c71..743839362 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/ModelsTest.java
@@ -42,6 +42,10 @@ public class ModelsTest {
public void testPdpModels() {
final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterTester())
.with(new GetterTester()).build();
- validator.validate(POJO_PACKAGE, new FilterPackageInfo(), new FilterClassName(PdpMessage.class.getName()));
+
+ // exclude Test classes and PdpMessage
+ validator.validate(POJO_PACKAGE, new FilterPackageInfo(),
+ new FilterClassName("^((?!Test$).)*$"),
+ new FilterClassName("^((?!" + PdpMessage.class.getName() + ").)*$"));
}
}
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
index 22e178da2..e0fafc18d 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java
@@ -82,6 +82,11 @@ public class PdpGroupsTest {
groupX.setName(null);
groups.setGroups(Arrays.asList(group1, groupX));
assertInvalid(groups);
+
+ // duplicate groups
+ groups = new PdpGroups();
+ groups.setGroups(Arrays.asList(group1, group2, group1));
+ assertInvalid(groups);
}
private void assertInvalid(PdpGroups groups) {