Models junits are failing locally 08/105108/2
authorJim Hahn <jrh3@att.com>
Fri, 3 Apr 2020 21:45:29 +0000 (17:45 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 3 Apr 2020 22:00:05 +0000 (18:00 -0400)
Junits were failing in my local eclipse environment.  Fixed the
following:
- more cases of "is marked @NonNull but is null" (I thought Liam had
  already fixed all of these, but I'm still seeing errors, so fixed
  some more)
- comparing "Instant" values in event time stamps assumes that
  the times will be different, but may not be, if the JVM is fast
  enough.  Modified the test to set the times of the new events to
  Instant+1, to ensure that they are different from the original

Issue-ID: POLICY-2305
Change-Id: Ic05bc6a58b559ba589583ce887711ee01f76691c
Signed-off-by: Jim Hahn <jrh3@att.com>
models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java
models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java
models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java
models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java
models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java
pom.xml

index e1ef77e..22ef769 100644 (file)
@@ -41,7 +41,7 @@ public class AbatedTest {
         assertEquals(event.getClosedLoopAlarmStart(), abated.getClosedLoopAlarmStart());
         assertEquals(ControlLoopEventStatus.ABATED, abated.getClosedLoopEventStatus());
 
-        abated.setClosedLoopAlarmEnd(Instant.now());
+        abated.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
         assertNotEquals(abated, event);
 
         assertEquals(new Abated(abated), abated);
index d7007bc..5aa7497 100644 (file)
@@ -38,8 +38,8 @@ public class CanonicalAbatedTest {
 
         CanonicalAbated abated2 = new CanonicalAbated(new Abated());
         abated2.setRequestId(UUID.randomUUID());
-        abated2.setClosedLoopAlarmStart(Instant.now());
-        abated2.setClosedLoopAlarmEnd(Instant.now());
+        abated2.setClosedLoopAlarmStart(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
+        abated2.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
 
         CanonicalAbated abated3 = new CanonicalAbated(abated2);
 
index 7b0a43f..23e1fff 100644 (file)
@@ -38,8 +38,8 @@ public class CanonicalOnsetTest {
 
         CanonicalOnset onset2 = new CanonicalOnset(new Onset());
         onset2.setRequestId(UUID.randomUUID());
-        onset2.setClosedLoopAlarmStart(Instant.now());
-        onset2.setClosedLoopAlarmEnd(Instant.now());
+        onset2.setClosedLoopAlarmStart(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
+        onset2.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
 
         CanonicalOnset onset3 = new CanonicalOnset(onset2);
 
index b229b02..5dadff1 100644 (file)
@@ -42,7 +42,7 @@ public class OnsetTest {
         assertEquals(ControlLoopEventStatus.ONSET, onset.getClosedLoopEventStatus());
         assertEquals(event.getClosedLoopAlarmEnd(), onset.getClosedLoopAlarmEnd());
 
-        onset.setClosedLoopAlarmEnd(Instant.now());
+        onset.setClosedLoopAlarmEnd(Instant.ofEpochSecond(Instant.now().getEpochSecond() + 1));
         assertNotEquals(onset, event);
 
         assertEquals(new Onset(onset), onset);
index 9ffb0f4..6a0ae6b 100644 (file)
@@ -77,7 +77,7 @@ public class PdpGroupFilterTest {
 
         assertThatThrownBy(() -> {
             filter.filter(null);
-        }).hasMessage("originalList is marked @NonNull but is null");
+        }).hasMessageMatching("originalList is marked .*ull but is null");
     }
 
     @Test
index b40c919..bd11915 100644 (file)
@@ -48,7 +48,8 @@ import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
  */
 public class JpaPdpGroupTest {
 
-    private static final String NULL_KEY_ERROR = "key is marked @NonNull but is null";
+    private static final String NULL_ERROR = " is marked .*ull but is null";
+    private static final String NULL_KEY_ERROR = "key" + NULL_ERROR;
     private static final String PDP_GROUP0 = "PDPGroup0";
     private static final String VERSION = "1.0.0";
 
@@ -56,43 +57,43 @@ public class JpaPdpGroupTest {
     public void testJpaPdpGroup() {
         assertThatThrownBy(() -> {
             new JpaPdpGroup((JpaPdpGroup) null);
-        }).hasMessage("copyConcept is marked @NonNull but is null");
+        }).hasMessageMatching("copyConcept" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup((PfConceptKey) null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup((PdpGroup) null);
-        }).hasMessage("authorativeConcept is marked @NonNull but is null");
+        }).hasMessageMatching("authorativeConcept" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup((JpaPdpGroup) null);
-        }).hasMessage("copyConcept is marked @NonNull but is null");
+        }).hasMessageMatching("copyConcept" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup(null, null, null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup(new PfConceptKey(), null, null);
-        }).hasMessage("pdpGroupState is marked @NonNull but is null");
+        }).hasMessageMatching("pdpGroupState" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup(new PfConceptKey(), PdpState.PASSIVE, null);
-        }).hasMessage("pdpSubGroups is marked @NonNull but is null");
+        }).hasMessageMatching("pdpSubGroups" + NULL_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup(null, PdpState.PASSIVE, null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup(null, PdpState.PASSIVE, new ArrayList<>());
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpGroup(null, null, new ArrayList<>());
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertNotNull(new JpaPdpGroup((new PfConceptKey())));
         assertNotNull(new JpaPdpGroup((new JpaPdpGroup())));
@@ -114,7 +115,7 @@ public class JpaPdpGroupTest {
 
         assertThatThrownBy(() -> {
             testJpaPdpGroup.fromAuthorative(null);
-        }).hasMessage("pdpGroup is marked @NonNull but is null");
+        }).hasMessageMatching("pdpGroup" + NULL_ERROR);
 
         testJpaPdpGroup.setKey(new PfConceptKey(PDP_GROUP0, VERSION));
         testJpaPdpGroup.fromAuthorative(testPdpGroup);
@@ -130,7 +131,7 @@ public class JpaPdpGroupTest {
 
         assertThatThrownBy(() -> {
             testJpaPdpGroup.validate(null);
-        }).hasMessage("resultIn is marked @NonNull but is null");
+        }).hasMessageMatching("resultIn" + NULL_ERROR);
 
         assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
         testJpaPdpGroup.setPdpGroupState(PdpState.PASSIVE);
index 2d23069..6b3f151 100644 (file)
@@ -48,70 +48,70 @@ import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
  */
 public class JpaPdpSubGroupTest {
 
-    private static final String NULL_KEY_ERROR = "key is marked @NonNull but is null";
+    private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
     private static final String PDP_A = "PDP-A";
 
     @Test
     public void testJpaPdpSubGroup() {
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup((JpaPdpSubGroup) null);
-        }).hasMessage("copyConcept is marked @NonNull but is null");
+        }).hasMessageMatching("copyConcept is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup((PfReferenceKey) null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup((PdpSubGroup) null);
-        }).hasMessage("authorativeConcept is marked @NonNull but is null");
+        }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, null, null, null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(new PfReferenceKey(), null, null, null);
-        }).hasMessage("supportedPolicyTypes is marked @NonNull but is null");
+        }).hasMessageMatching("supportedPolicyTypes is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(new PfReferenceKey(), new ArrayList<>(), null, null);
-        }).hasMessage("policies is marked @NonNull but is null");
+        }).hasMessageMatching("policies is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, new ArrayList<>(), null, null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, new ArrayList<>(), new ArrayList<>(), null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, null, new ArrayList<>(), null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, null, null, new ArrayList<>());
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(new PfReferenceKey(), null, null, new ArrayList<>());
-        }).hasMessage("supportedPolicyTypes is marked @NonNull but is null");
+        }).hasMessageMatching("supportedPolicyTypes is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(new PfReferenceKey(), new ArrayList<>(), null, new ArrayList<>());
-        }).hasMessage("policies is marked @NonNull but is null");
+        }).hasMessageMatching("policies is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, new ArrayList<>(), null, new ArrayList<>());
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdpSubGroup(null, null, new ArrayList<>(), null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertNotNull(new JpaPdpSubGroup((new PfReferenceKey())));
 
@@ -126,7 +126,7 @@ public class JpaPdpSubGroupTest {
 
         assertThatThrownBy(() -> {
             testJpaPdpSubGroup.fromAuthorative(null);
-        }).hasMessage("pdpSubgroup is marked @NonNull but is null");
+        }).hasMessageMatching("pdpSubgroup is marked .*ull but is null");
 
         assertThatThrownBy(() -> new JpaPdpSubGroup((JpaPdpSubGroup) null)).isInstanceOf(NullPointerException.class);
 
@@ -139,7 +139,7 @@ public class JpaPdpSubGroupTest {
 
         assertThatThrownBy(() -> {
             testJpaPdpSubGroup.validate(null);
-        }).hasMessage("resultIn is marked @NonNull but is null");
+        }).hasMessageMatching("resultIn is marked .*ull but is null");
 
         assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
         assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
index b6d5161..e17b8a8 100644 (file)
@@ -43,46 +43,46 @@ import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpChild;
  */
 public class JpaPdpTest {
 
-    private static final String NULL_KEY_ERROR = "key is marked @NonNull but is null";
+    private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
     private static final String PDP1 = "ThePDP";
 
     @Test
     public void testJpaPdp() {
         assertThatThrownBy(() -> {
             new JpaPdp((JpaPdp) null);
-        }).hasMessage("copyConcept is marked @NonNull but is null");
+        }).hasMessageMatching("copyConcept is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdp((PfReferenceKey) null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdp(null, null, null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdp(new PfReferenceKey(), null, null);
-        }).hasMessage("pdpState is marked @NonNull but is null");
+        }).hasMessageMatching("pdpState is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdp(new PfReferenceKey(), PdpState.ACTIVE, null);
-        }).hasMessage("healthy is marked @NonNull but is null");
+        }).hasMessageMatching("healthy is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new JpaPdp(null, PdpState.ACTIVE, null);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdp(null, PdpState.ACTIVE, PdpHealthStatus.UNKNOWN);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdp(null, null, PdpHealthStatus.UNKNOWN);
-        }).hasMessage(NULL_KEY_ERROR);
+        }).hasMessageMatching(NULL_KEY_ERROR);
 
         assertThatThrownBy(() -> {
             new JpaPdp((Pdp) null);
-        }).hasMessage("authorativeConcept is marked @NonNull but is null");
+        }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
 
         assertNotNull(new JpaPdp((new PfReferenceKey())));
 
@@ -97,7 +97,7 @@ public class JpaPdpTest {
 
         assertThatThrownBy(() -> {
             testJpaPdp.fromAuthorative(null);
-        }).hasMessage("pdp is marked @NonNull but is null");
+        }).hasMessageMatching("pdp is marked .*ull but is null");
 
         assertThatThrownBy(() -> new JpaPdp((JpaPdp) null)).isInstanceOf(NullPointerException.class);
 
@@ -114,7 +114,7 @@ public class JpaPdpTest {
 
         assertThatThrownBy(() -> {
             testJpaPdp.validate(null);
-        }).hasMessage("resultIn is marked @NonNull but is null");
+        }).hasMessageMatching("resultIn is marked .*ull but is null");
 
         assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
         assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
index 824c0a4..c4a7a3d 100644 (file)
@@ -59,10 +59,10 @@ import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider;
  */
 public class PdpProviderTest {
     private static final String PDP_GROUPS0_JSON = "testdata/PdpGroups0.json";
-    private static final String PDP_TYPE_IS_NULL = "pdpType is marked @NonNull but is null";
-    private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked @NonNull but is null";
-    private static final String GROUP_IS_NULL = "pdpGroupName is marked @NonNull but is null";
-    private static final String DAO_IS_NULL = "dao is marked @NonNull but is null";
+    private static final String PDP_TYPE_IS_NULL = "pdpType is marked .*ull but is null";
+    private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked .*ull but is null";
+    private static final String GROUP_IS_NULL = "pdpGroupName is marked .*ull but is null";
+    private static final String DAO_IS_NULL = "dao is marked .*ull but is null";
     private static final String PDP_GROUP0 = "PdpGroup0";
     private PfDao pfDao;
     private StandardCoder standardCoder;
@@ -111,11 +111,11 @@ public class PdpProviderTest {
     public void testGroupsGet() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().getPdpGroups(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().getPdpGroups(null, "name");
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON);
         PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
@@ -137,15 +137,15 @@ public class PdpProviderTest {
     public void testFilteredPdpGroupGet() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().getFilteredPdpGroups(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().getFilteredPdpGroups(null, PdpGroupFilter.builder().build());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().getFilteredPdpGroups(pfDao, null);
-        }).hasMessage("filter is marked @NonNull but is null");
+        }).hasMessageMatching("filter is marked .*ull but is null");
 
         String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroupsForFiltering.json");
         PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
@@ -177,15 +177,15 @@ public class PdpProviderTest {
     public void testGroupsCreate() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().createPdpGroups(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().createPdpGroups(null, new ArrayList<>());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().createPdpGroups(pfDao, null);
-        }).hasMessage("pdpGroups is marked @NonNull but is null");
+        }).hasMessageMatching("pdpGroups is marked .*ull but is null");
 
         String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON);
         PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
@@ -232,15 +232,15 @@ public class PdpProviderTest {
     public void testGroupsUpdate() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpGroups(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpGroups(null, new ArrayList<>());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpGroups(pfDao, null);
-        }).hasMessage("pdpGroups is marked @NonNull but is null");
+        }).hasMessageMatching("pdpGroups is marked .*ull but is null");
 
         String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON);
         PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class);
@@ -276,15 +276,15 @@ public class PdpProviderTest {
     public void testPoliciesDelete() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().deletePdpGroup(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().deletePdpGroup(null, "name");
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().deletePdpGroup(pfDao, null);
-        }).hasMessage("name is marked @NonNull but is null");
+        }).hasMessageMatching("name is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new PdpProvider().deletePdpGroup(pfDao, "name");
@@ -319,31 +319,31 @@ public class PdpProviderTest {
     public void testPdpSubgroupUpdate() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(null, null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(null, null, new PdpSubGroup());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(null, "name", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(null, "name", new PdpSubGroup());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(pfDao, null, null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(pfDao, null, new PdpSubGroup());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(pfDao, "name", null);
-        }).hasMessage(SUBGROUP_IS_NULL);
+        }).hasMessageMatching(SUBGROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpSubGroup(pfDao, "name", new PdpSubGroup());
@@ -383,63 +383,63 @@ public class PdpProviderTest {
     public void testPdpUpdate() throws Exception {
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, null, null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, null, null, new Pdp());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, null, "TYPE", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, null, "TYPE", new Pdp());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, "name", null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, "name", null, new Pdp());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, "name", "TYPE", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(null, "name", "TYPE", new Pdp());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, null, null, null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, null, null, new Pdp());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, null, "TYPE", null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, null, "TYPE", new Pdp());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, "name", null, null);
-        }).hasMessage(SUBGROUP_IS_NULL);
+        }).hasMessageMatching(SUBGROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, "name", null, new Pdp());
-        }).hasMessage(SUBGROUP_IS_NULL);
+        }).hasMessageMatching(SUBGROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, "name", "TYPE", null);
-        }).hasMessage("pdp is marked @NonNull but is null");
+        }).hasMessageMatching("pdp is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdp(pfDao, "name", "TYPE", new Pdp());
@@ -481,11 +481,11 @@ public class PdpProviderTest {
     public void testGetPdpStatistics() throws PfModelException {
         assertThatThrownBy(() -> {
             new PdpProvider().getPdpStatistics(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().getPdpStatistics(null, "name");
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertEquals(0, new PdpProvider().getPdpStatistics(pfDao, "name").size());
     }
@@ -494,127 +494,127 @@ public class PdpProviderTest {
     public void testUpdatePdpStatistics() throws PfModelException {
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, null, null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, null, null, new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, null, "inst", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, null, "inst", new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", null, null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", null, null, new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", null, "inst", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", null, "inst", new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", new PdpStatistics());
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, null, null, null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, null, null, new PdpStatistics());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", new PdpStatistics());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, new PdpStatistics());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", null);
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", new PdpStatistics());
-        }).hasMessage(GROUP_IS_NULL);
+        }).hasMessageMatching(GROUP_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, null);
-        }).hasMessage(PDP_TYPE_IS_NULL);
+        }).hasMessageMatching(PDP_TYPE_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, new PdpStatistics());
-        }).hasMessage(PDP_TYPE_IS_NULL);
+        }).hasMessageMatching(PDP_TYPE_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", null);
-        }).hasMessage(PDP_TYPE_IS_NULL);
+        }).hasMessageMatching(PDP_TYPE_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", new PdpStatistics());
-        }).hasMessage(PDP_TYPE_IS_NULL);
+        }).hasMessageMatching(PDP_TYPE_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, null);
-        }).hasMessage("pdpInstanceId is marked @NonNull but is null");
+        }).hasMessageMatching("pdpInstanceId is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, new PdpStatistics());
-        }).hasMessage("pdpInstanceId is marked @NonNull but is null");
+        }).hasMessageMatching("pdpInstanceId is marked .*ull but is null");
 
         assertThatThrownBy(() -> {
             new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", "inst", null);
-        }).hasMessage("pdpStatistics is marked @NonNull but is null");
+        }).hasMessageMatching("pdpStatistics is marked .*ull but is null");
 
         new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", "inst", new PdpStatistics());
     }
index effebe4..904e5f1 100644 (file)
@@ -40,8 +40,8 @@ import org.onap.policy.models.pdp.concepts.PdpEngineWorkerStatistics;
 import org.onap.policy.models.pdp.concepts.PdpStatistics;
 
 public class PdpStatisticsProviderTest {
-    private static final String DAO_IS_NULL = "dao is marked @NonNull but is null";
-    private static final String LIST_IS_NULL = "pdpStatisticsList is marked @NonNull but is null";
+    private static final String DAO_IS_NULL = "dao is marked .*ull but is null";
+    private static final String LIST_IS_NULL = "pdpStatisticsList is marked .*ull but is null";
     private static final String GROUP0 = "group0";
     private static final String NAME = "name";
     private static final String GROUP = "group";
@@ -133,11 +133,11 @@ public class PdpStatisticsProviderTest {
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().createPdpStatistics(pfDao, null);
-        }).hasMessage(LIST_IS_NULL);
+        }).hasMessageMatching(LIST_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().updatePdpStatistics(pfDao, null);
-        }).hasMessage(LIST_IS_NULL);
+        }).hasMessageMatching(LIST_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().createPdpStatistics(pfDao, pdpStatisticsNullList);
@@ -152,10 +152,10 @@ public class PdpStatisticsProviderTest {
     public void testGetPdpStatistics() throws Exception {
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().createPdpStatistics(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().getPdpStatistics(null, null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         List<PdpStatistics> getPdpStatisticsList;
         getPdpStatisticsList = new PdpStatisticsProvider().getPdpStatistics(pfDao, NAME, TIMESTAMP1);
@@ -174,12 +174,12 @@ public class PdpStatisticsProviderTest {
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().getFilteredPdpStatistics(null, NAME, GROUP, SUBGROUP, TIMESTAMP1, TIMESTAMP2,
                     ORDER, 1);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().getFilteredPdpStatistics(pfDao, NAME, null, null, TIMESTAMP1, TIMESTAMP2, ORDER,
                     1);
-        }).hasMessage("pdpGroupName is marked @NonNull but is null");
+        }).hasMessageMatching("pdpGroupName is marked .*ull but is null");
 
 
         List<PdpStatistics> createdPdpStatisticsList;
@@ -203,7 +203,7 @@ public class PdpStatisticsProviderTest {
     public void testUpdatePdpStatistics() throws Exception {
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().updatePdpStatistics(null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         pdpStatisticsTestList.get(0).setPdpGroupName(GROUP0);
         testListStr = pdpStatisticsTestList.toString();
@@ -218,11 +218,11 @@ public class PdpStatisticsProviderTest {
     public void testDeletePdpStatistics() throws Exception {
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().deletePdpStatistics(null, null, null);
-        }).hasMessage(DAO_IS_NULL);
+        }).hasMessageMatching(DAO_IS_NULL);
 
         assertThatThrownBy(() -> {
             new PdpStatisticsProvider().deletePdpStatistics(pfDao, null, null);
-        }).hasMessage("name is marked @NonNull but is null");
+        }).hasMessageMatching("name is marked .*ull but is null");
 
         List<PdpStatistics> deletedPdpStatisticsList =
                 new PdpStatisticsProvider().deletePdpStatistics(pfDao, NAME, null);
diff --git a/pom.xml b/pom.xml
index 65304da..f84db81 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.policy.parent</groupId>
         <artifactId>integration</artifactId>
-        <version>3.1.1</version>
+        <version>3.1.2-SNAPSHOT</version>
         <relativePath />
     </parent>