diff options
author | Jim Hahn <jrh3@att.com> | 2020-04-06 14:00:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-06 14:00:11 +0000 |
commit | 3000fdca611c32b7001c553621660b8ea0d2eb49 (patch) | |
tree | ec698ea6a1ea847cd96956ce5d39c01358de1439 | |
parent | e55503959d257661bc3bac4f5e4dfc0726c9f6ae (diff) | |
parent | ea9113151c030efdd9b393787f1e57bc72734e88 (diff) |
Merge "Models junits are failing locally"
10 files changed, 135 insertions, 134 deletions
diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java index e1ef77e22..22ef769f9 100644 --- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java +++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/AbatedTest.java @@ -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); diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java index d7007bc97..5aa7497e9 100644 --- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java +++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalAbatedTest.java @@ -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); diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java index 7b0a43f9e..23e1fffbd 100644 --- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java +++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/CanonicalOnsetTest.java @@ -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); diff --git a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java index b229b024b..5dadff1b6 100644 --- a/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java +++ b/models-interactions/model-impl/events/src/test/java/org/onap/policy/controlloop/OnsetTest.java @@ -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); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java index 9ffb0f41d..6a0ae6b4e 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java @@ -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 diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java index b40c91982..bd1191594 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java @@ -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); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java index 2d2306978..6b3f151fc 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java @@ -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() diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java index b6d5161f8..e17b8a8b4 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java @@ -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() diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java index 824c0a4fe..c4a7a3d60 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java @@ -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()); } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java index effebe439..904e5f135 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java @@ -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); |