diff options
Diffstat (limited to 'models-pdp')
3 files changed, 106 insertions, 101 deletions
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java index 9047a7ae1..dc6726846 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpMessageTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import org.onap.policy.models.pdp.enums.PdpMessageType; public class PdpMessageTest { - private static final String PDP_GROUP_STRING = " pdp group "; + private static final String PDP_GROUP_MSG = " pdp group "; private static final String PDP_NAME = "pdpA"; private static final String PDP_GROUP = "groupA"; private static final String PDP_SUBGROUP = "subgroupA"; @@ -65,13 +65,7 @@ public class PdpMessageTest { for (String msgGroup : new String[] {null, PDP_GROUP, DIFFERENT}) { for (String msgSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) { message = makeMessage(PDP_NAME, msgGroup, msgSubgroup); - - for (String pdpGroup : new String[] {null, PDP_GROUP, DIFFERENT}) { - for (String pdpSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) { - assertTrue("name msg " + message + PDP_GROUP_STRING + pdpGroup + "/" + pdpSubgroup, - message.appliesTo(PDP_NAME, pdpGroup, pdpSubgroup)); - } - } + testName(PDP_NAME, true); } } @@ -81,13 +75,16 @@ public class PdpMessageTest { for (String msgGroup : new String[] {null, PDP_GROUP, DIFFERENT}) { for (String msgSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) { message = makeMessage(PDP_NAME, msgGroup, msgSubgroup); + testName(DIFFERENT, false); + } + } + } - for (String pdpGroup : new String[] {null, PDP_GROUP, DIFFERENT}) { - for (String pdpSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) { - assertFalse("name msg " + message + PDP_GROUP_STRING + pdpGroup + "/" + pdpSubgroup, - message.appliesTo(DIFFERENT, pdpGroup, pdpSubgroup)); - } - } + private void testName(String pdpName, boolean expectMatch) { + for (String pdpGroup : new String[] {null, PDP_GROUP, DIFFERENT}) { + for (String pdpSubgroup : new String[] {null, PDP_SUBGROUP, DIFFERENT}) { + assertEquals("name msg " + message + PDP_GROUP_MSG + pdpGroup + "/" + pdpSubgroup, expectMatch, + message.appliesTo(pdpName, pdpGroup, pdpSubgroup)); } } } @@ -111,7 +108,7 @@ public class PdpMessageTest { message = makeMessage(null, msgGroup, msgSubgroup); for (String pdpGroup : new String[] {null, DIFFERENT}) { - assertFalse("group msg " + message + PDP_GROUP_STRING + pdpGroup, + assertFalse("group msg " + message + PDP_GROUP_MSG + pdpGroup, message.appliesTo(PDP_NAME, pdpGroup, PDP_SUBGROUP)); } } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java index 7a7babecc..e24e8e2d6 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java @@ -44,6 +44,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi * Test methods not tested by {@link ModelsTest}. */ public class PdpSubGroupTest { + private static final String VERSION_300 = "3.0.0"; private static final Coder coder = new StandardCoder(); @Test @@ -95,7 +96,8 @@ public class PdpSubGroupTest { subgrp.setDesiredInstanceCount(1); subgrp.setPdpType("pdp-type"); - subgrp.setSupportedPolicyTypes(Arrays.asList(makeIdent("type-X", "3.0.0", ToscaPolicyTypeIdentifier.class))); + subgrp.setSupportedPolicyTypes( + Arrays.asList(makeIdent("type-X", VERSION_300, ToscaPolicyTypeIdentifier.class))); subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaPolicyIdentifier.class))); // valid @@ -136,7 +138,7 @@ public class PdpSubGroupTest { // invalid policy type item sub2 = new PdpSubGroup(subgrp); - sub2.getSupportedPolicyTypes().set(0, makeIdent(null, "3.0.0", ToscaPolicyTypeIdentifier.class)); + sub2.getSupportedPolicyTypes().set(0, makeIdent(null, VERSION_300, ToscaPolicyTypeIdentifier.class)); assertInvalid(sub2); // null policies @@ -151,7 +153,7 @@ public class PdpSubGroupTest { // invalid policy item sub2 = new PdpSubGroup(subgrp); - sub2.getPolicies().set(0, makeIdent(null, "3.0.0", ToscaPolicyIdentifier.class)); + sub2.getPolicies().set(0, makeIdent(null, VERSION_300, ToscaPolicyIdentifier.class)); assertInvalid(sub2); } 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 4314b81c1..5cbbaaa8f 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 @@ -58,6 +58,12 @@ import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider; * @author Liam Fallon (liam.fallon@est.tech) */ 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_GROUP0 = "PdpGroup0"; private PfDao pfDao; private StandardCoder standardCoder; @@ -105,13 +111,13 @@ public class PdpProviderTest { public void testGroupsGet() throws Exception { assertThatThrownBy(() -> { new PdpProvider().getPdpGroups(null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().getPdpGroups(null, "name"); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); - String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); + String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); PdpGroups createdPdpGroups0 = new PdpGroups(); @@ -120,7 +126,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0)); String gotJson = standardCoder.encode(gotPdpGroups0); @@ -131,11 +137,11 @@ public class PdpProviderTest { public void testFilteredPdpGroupGet() throws Exception { assertThatThrownBy(() -> { new PdpProvider().getFilteredPdpGroups(null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().getFilteredPdpGroups(null, PdpGroupFilter.builder().build()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().getFilteredPdpGroups(pfDao, null); @@ -155,7 +161,7 @@ public class PdpProviderTest { // @formatter:off final PdpGroupFilter filter = PdpGroupFilter.builder() .groupState(PdpState.PASSIVE) - .name("PdpGroup0") + .name(PDP_GROUP0) .matchPoliciesExactly(false) .matchPolicyTypesExactly(false) .pdpState(PdpState.PASSIVE) @@ -171,17 +177,17 @@ public class PdpProviderTest { public void testGroupsCreate() throws Exception { assertThatThrownBy(() -> { new PdpProvider().createPdpGroups(null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().createPdpGroups(null, new ArrayList<>()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().createPdpGroups(pfDao, null); }).hasMessage("pdpGroups is marked @NonNull but is null"); - String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); + String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); PdpGroups createdPdpGroups0 = new PdpGroups(); @@ -190,7 +196,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0)); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -226,17 +232,17 @@ public class PdpProviderTest { public void testGroupsUpdate() throws Exception { assertThatThrownBy(() -> { new PdpProvider().updatePdpGroups(null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpGroups(null, new ArrayList<>()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpGroups(pfDao, null); }).hasMessage("pdpGroups is marked @NonNull but is null"); - String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); + String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); PdpGroups createdPdpGroups0 = new PdpGroups(); @@ -245,7 +251,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0)); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -270,11 +276,11 @@ public class PdpProviderTest { public void testPoliciesDelete() throws Exception { assertThatThrownBy(() -> { new PdpProvider().deletePdpGroup(null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().deletePdpGroup(null, "name"); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().deletePdpGroup(pfDao, null); @@ -284,7 +290,7 @@ public class PdpProviderTest { new PdpProvider().deletePdpGroup(pfDao, "name"); }).hasMessage("delete of PDP group \"name:0.0.0\" failed, PDP group does not exist"); - String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); + String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); PdpGroups createdPdpGroups0 = new PdpGroups(); @@ -293,19 +299,19 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0)); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); - PdpGroup deletedPdpGroup = new PdpProvider().deletePdpGroup(pfDao, "PdpGroup0"); + PdpGroup deletedPdpGroup = new PdpProvider().deletePdpGroup(pfDao, PDP_GROUP0); assertEquals(createdPdpGroups0.getGroups().get(0), deletedPdpGroup); - assertEquals(0, new PdpProvider().getPdpGroups(pfDao, "PdpGroup0").size()); + assertEquals(0, new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0).size()); assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(pfDao, "PdpGroup0"); + new PdpProvider().deletePdpGroup(pfDao, PDP_GROUP0); }).hasMessage("delete of PDP group \"PdpGroup0:0.0.0\" failed, PDP group does not exist"); } @@ -313,37 +319,37 @@ public class PdpProviderTest { public void testPdpSubgroupUpdate() throws Exception { assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(null, null, new PdpSubGroup()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(null, "name", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(null, "name", new PdpSubGroup()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(pfDao, null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(pfDao, null, new PdpSubGroup()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(pfDao, "name", null); - }).hasMessage("pdpSubGroup is marked @NonNull but is null"); + }).hasMessage(SUBGROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpSubGroup(pfDao, "name", new PdpSubGroup()); }).hasMessage("parameter \"localName\" is null"); - String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); + String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); PdpGroups createdPdpGroups0 = new PdpGroups(); @@ -352,7 +358,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0)); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -360,15 +366,15 @@ public class PdpProviderTest { PdpSubGroup existingSubGroup = gotPdpGroups0.getGroups().get(0).getPdpSubgroups().get(0); existingSubGroup.setCurrentInstanceCount(10); existingSubGroup.setDesiredInstanceCount(10); - new PdpProvider().updatePdpSubGroup(pfDao, "PdpGroup0", existingSubGroup); + new PdpProvider().updatePdpSubGroup(pfDao, PDP_GROUP0, existingSubGroup); - List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, "PdpGroup0"); + List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0); assertEquals(10, afterUpdatePdpGroups.get(0).getPdpSubgroups().get(0).getCurrentInstanceCount()); assertEquals(10, afterUpdatePdpGroups.get(0).getPdpSubgroups().get(0).getDesiredInstanceCount()); existingSubGroup.setDesiredInstanceCount(-1); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, "PdpGroup0", existingSubGroup); + new PdpProvider().updatePdpSubGroup(pfDao, PDP_GROUP0, existingSubGroup); }).hasMessageContaining("INVALID:the desired instance count of a PDP sub group may not be negative"); existingSubGroup.setDesiredInstanceCount(10); } @@ -377,59 +383,59 @@ public class PdpProviderTest { public void testPdpUpdate() throws Exception { assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, null, null, new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, null, "TYPE", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, null, "TYPE", new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, "name", null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, "name", null, new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, "name", "TYPE", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(null, "name", "TYPE", new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, null, null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, null, null, new Pdp()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, null, "TYPE", null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, null, "TYPE", new Pdp()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, "name", null, null); - }).hasMessage("pdpSubGroup is marked @NonNull but is null"); + }).hasMessage(SUBGROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, "name", null, new Pdp()); - }).hasMessage("pdpSubGroup is marked @NonNull but is null"); + }).hasMessage(SUBGROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdp(pfDao, "name", "TYPE", null); @@ -439,7 +445,7 @@ public class PdpProviderTest { new PdpProvider().updatePdp(pfDao, "name", "TYPE", new Pdp()); }).hasMessage("parameter \"localName\" is null"); - String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); + String originalJson = ResourceUtils.getResourceAsString(PDP_GROUPS0_JSON); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); PdpGroups createdPdpGroups0 = new PdpGroups(); @@ -448,7 +454,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0)); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -456,9 +462,9 @@ public class PdpProviderTest { Pdp existingPdp = gotPdpGroups0.getGroups().get(0).getPdpSubgroups().get(0).getPdpInstances().get(0); existingPdp.setPdpState(PdpState.TEST); existingPdp.setHealthy(PdpHealthStatus.TEST_IN_PROGRESS); - new PdpProvider().updatePdp(pfDao, "PdpGroup0", "APEX", existingPdp); + new PdpProvider().updatePdp(pfDao, PDP_GROUP0, "APEX", existingPdp); - List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, "PdpGroup0"); + List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, PDP_GROUP0); assertEquals(PdpState.TEST, afterUpdatePdpGroups.get(0).getPdpSubgroups().get(0).getPdpInstances().get(0).getPdpState()); assertEquals(PdpHealthStatus.TEST_IN_PROGRESS, @@ -466,7 +472,7 @@ public class PdpProviderTest { existingPdp.setMessage(""); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "PdpGroup0", "APEX", existingPdp); + new PdpProvider().updatePdp(pfDao, PDP_GROUP0, "APEX", existingPdp); }).hasMessageContaining("INVALID:message may not be blank"); existingPdp.setMessage("A Message"); } @@ -475,11 +481,11 @@ public class PdpProviderTest { public void testGetPdpStatistics() throws PfModelException { assertThatThrownBy(() -> { new PdpProvider().getPdpStatistics(null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().getPdpStatistics(null, "name"); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertEquals(0, new PdpProvider().getPdpStatistics(pfDao, "name").size()); } @@ -488,115 +494,115 @@ public class PdpProviderTest { public void testUpdatePdpStatistics() throws PfModelException { assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, null, null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, null, "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, null, "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", null, null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", null, "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", null, "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); + }).hasMessage(DAO_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, null, null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, null, null, new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); + }).hasMessage(GROUP_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, null); - }).hasMessage("pdpType is marked @NonNull but is null"); + }).hasMessage(PDP_TYPE_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, new PdpStatistics()); - }).hasMessage("pdpType is marked @NonNull but is null"); + }).hasMessage(PDP_TYPE_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", null); - }).hasMessage("pdpType is marked @NonNull but is null"); + }).hasMessage(PDP_TYPE_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", new PdpStatistics()); - }).hasMessage("pdpType is marked @NonNull but is null"); + }).hasMessage(PDP_TYPE_IS_NULL); assertThatThrownBy(() -> { new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, null); |