summaryrefslogtreecommitdiffstats
path: root/models-pdp/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'models-pdp/src/test/java')
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java31
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java6
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroupTest.java64
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java50
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java14
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpStatisticsProviderTest.java8
6 files changed, 88 insertions, 85 deletions
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 a013addab..a4bf25209 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
@@ -35,7 +35,6 @@ import java.util.List;
import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
import org.onap.policy.models.pdp.concepts.PdpGroup;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
@@ -130,44 +129,44 @@ public class JpaPdpGroupTest {
assertThatThrownBy(() -> {
testJpaPdpGroup.validate(null);
- }).hasMessageMatching("resultIn" + NULL_ERROR);
+ }).hasMessageMatching("fieldName" + NULL_ERROR);
- assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setPdpGroupState(PdpState.PASSIVE);
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setKey(PfConceptKey.getNullKey());
- assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setKey(new PfConceptKey("PdpGroup0", VERSION));
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setDescription(" ");
- assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setDescription(" A Description ");
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setDescription(null);
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setProperties(new LinkedHashMap<>());
testJpaPdpGroup.getProperties().put(null, null);
- assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.getProperties().remove(null);
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setProperties(new LinkedHashMap<>());
testJpaPdpGroup.getProperties().put("NullKey", null);
- assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.getProperties().remove("NullKey");
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
List<JpaPdpSubGroup> jpaPdpSubgroups = testJpaPdpGroup.getPdpSubGroups();
assertNotNull(jpaPdpSubgroups);
testJpaPdpGroup.setPdpSubGroups(null);
- assertFalse(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setPdpSubGroups(new ArrayList<>());
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
testJpaPdpGroup.setPdpSubGroups(jpaPdpSubgroups);
- assertTrue(testJpaPdpGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpGroup.validate("").isValid());
JpaPdpGroup otherJpaPdpGroup = new JpaPdpGroup(testJpaPdpGroup);
assertEquals(0, testJpaPdpGroup.compareTo(otherJpaPdpGroup));
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java
index b8d8d99a0..83cf85b8f 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpStatisticsTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +32,6 @@ import java.util.ArrayList;
import java.util.Date;
import org.junit.Test;
import org.onap.policy.models.base.PfTimestampKey;
-import org.onap.policy.models.base.PfValidationResult;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
/**
@@ -92,11 +92,11 @@ public class JpaPdpStatisticsTest {
@Test
public void testValidate() {
JpaPdpStatistics nullKeyJpaPdpStat = new JpaPdpStatistics();
- assertFalse(nullKeyJpaPdpStat.validate(new PfValidationResult()).isOk());
+ assertFalse(nullKeyJpaPdpStat.validate("").isValid());
PdpStatistics pdpStat = createPdpStatistics();
JpaPdpStatistics jpaPdpStat2 = new JpaPdpStatistics(pdpStat);
- assertTrue(jpaPdpStat2.validate(new PfValidationResult()).isOk());
+ assertTrue(jpaPdpStat2.validate("").isValid());
}
@Test
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 cb27151f8..969b59c6d 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
@@ -21,6 +21,7 @@
package org.onap.policy.models.pdp.persistence.concepts;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -36,7 +37,7 @@ import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
import org.onap.policy.models.base.PfSearchableKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.pdp.testconcepts.DummyJpaPdpSubgroupChild;
@@ -138,82 +139,79 @@ public class JpaPdpSubGroupTest {
assertThatThrownBy(() -> {
testJpaPdpSubGroup.validate(null);
- }).hasMessageMatching("resultIn is marked .*ull but is null");
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
- .contains("INVALID:parent of key is a null key"));
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
+ assertThat(testJpaPdpSubGroup.validate("").getResult())
+ .contains("parent of key").contains(Validated.IS_A_NULL_KEY);
testJpaPdpSubGroup.getKey().setParentConceptKey(new PfConceptKey("Parent:1.0.0"));
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
- .contains("INVALID:parent of key is a null key"));
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
- .contains("INVALID:a PDP subgroup must support at least one policy type"));
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
+ assertThat(testJpaPdpSubGroup.validate("").getResult())
+ .doesNotContain("parent of key")
+ .contains("supportedPolicyTypes").contains("is empty");
testJpaPdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
testJpaPdpSubGroup.getSupportedPolicyTypes().add(new PfSearchableKey("APolicyType:1.0.0"));
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).toString()
- .contains("INVALID:a PDP subgroup must support at least one policy type"));
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
PfReferenceKey savedKey = testJpaPdpSubGroup.getKey();
testJpaPdpSubGroup.setKey(PfReferenceKey.getNullKey());
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setKey(savedKey);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setProperties(new LinkedHashMap<>());
testJpaPdpSubGroup.getProperties().put(null, null);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.getProperties().remove(null);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setProperties(new LinkedHashMap<>());
testJpaPdpSubGroup.getProperties().put("NullKey", null);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.getProperties().remove("NullKey");
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setDesiredInstanceCount(-1);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setDesiredInstanceCount(0);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setProperties(null);
testJpaPdpSubGroup.setCurrentInstanceCount(-1);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setCurrentInstanceCount(0);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setProperties(null);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
List<PfSearchableKey> supportedPolicyTypes = testJpaPdpSubGroup.getSupportedPolicyTypes();
assertNotNull(supportedPolicyTypes);
testJpaPdpSubGroup.setSupportedPolicyTypes(null);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setSupportedPolicyTypes(supportedPolicyTypes);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
List<PfConceptKey> supportedPolicies = testJpaPdpSubGroup.getPolicies();
assertNotNull(supportedPolicies);
testJpaPdpSubGroup.setPolicies(null);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setPolicies(new ArrayList<>());
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setPolicies(supportedPolicies);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
List<JpaPdp> pdpInstances = testJpaPdpSubGroup.getPdpInstances();
assertNotNull(pdpInstances);
testJpaPdpSubGroup.setPdpInstances(null);
- assertFalse(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setPdpInstances(new ArrayList<>());
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
testJpaPdpSubGroup.setPdpInstances(pdpInstances);
- assertTrue(testJpaPdpSubGroup.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdpSubGroup.validate("").isValid());
JpaPdpSubGroup otherJpaPdpSubGroup = new JpaPdpSubGroup(testJpaPdpSubGroup);
assertEquals(0, testJpaPdpSubGroup.compareTo(otherJpaPdpSubGroup));
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 74a3c9e31..3102c5098 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
@@ -21,6 +21,7 @@
package org.onap.policy.models.pdp.persistence.concepts;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -31,7 +32,7 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.base.PfValidationResult;
+import org.onap.policy.models.base.Validated;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpState;
@@ -115,48 +116,45 @@ public class JpaPdpTest {
assertThatThrownBy(() -> {
testJpaPdp.validate(null);
- }).hasMessageMatching("resultIn is marked .*ull but is null");
+ }).hasMessageMatching("fieldName is marked .*ull but is null");
- assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
- assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:parent of key is a null key"));
+ assertFalse(testJpaPdp.validate("").isValid());
+ assertThat(testJpaPdp.validate("").getResult())
+ .contains("parent").contains(Validated.IS_A_NULL_KEY);
testJpaPdp.getKey().setParentConceptKey(new PfConceptKey("Parent:1.0.0"));
- assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
- assertFalse(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:parent of key is a null key"));
- assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:local name of parent of key is null"));
+ assertFalse(testJpaPdp.validate("").isValid());
+ assertThat(testJpaPdp.validate("").getResult())
+ .doesNotContain("\"parent\"")
+ .contains("local name").contains(Validated.IS_NULL);
testJpaPdp.getKey().setParentLocalName("ParentLocal");
- assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
- assertFalse(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:local name of parent of key is null"));
- assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:PDP state may not be null"));
+ assertFalse(testJpaPdp.validate("").isValid());
+ assertThat(testJpaPdp.validate("").getResult())
+ .doesNotContain("local name")
+ .contains("pdpState").contains(Validated.IS_NULL);
testJpaPdp.setPdpState(PdpState.ACTIVE);
- assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
- assertFalse(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:PDP state may not be null"));
- assertTrue(testJpaPdp.validate(new PfValidationResult()).toString()
- .contains("INVALID:PDP health status may not be null"));
+ assertFalse(testJpaPdp.validate("").isValid());
+ assertThat(testJpaPdp.validate("").getResult())
+ .doesNotContain("pdpState")
+ .contains("healthy").contains(Validated.IS_NULL);
testJpaPdp.setHealthy(PdpHealthStatus.HEALTHY);
- assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdp.validate("").isValid());
PfReferenceKey savedKey = testJpaPdp.getKey();
testJpaPdp.setKey(PfReferenceKey.getNullKey());
- assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdp.validate("").isValid());
testJpaPdp.setKey(savedKey);
- assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdp.validate("").isValid());
testJpaPdp.setMessage(null);
- assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdp.validate("").isValid());
testJpaPdp.setMessage("");
- assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
+ assertFalse(testJpaPdp.validate("").isValid());
testJpaPdp.setMessage("Valid Message");
- assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+ assertTrue(testJpaPdp.validate("").isValid());
JpaPdp otherJpaPdp = new JpaPdp(testJpaPdp);
assertEquals(0, testJpaPdp.compareTo(otherJpaPdp));
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 7dc5d3ae8..b6874726d 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
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import org.junit.Test;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.Validated;
import org.onap.policy.models.dao.DaoParameters;
import org.onap.policy.models.dao.PfDao;
import org.onap.policy.models.dao.PfDaoFactory;
@@ -204,7 +205,8 @@ public class PdpProviderTest {
pdpGroups0.getGroups().get(0).setPdpGroupState(null);
assertThatThrownBy(() -> {
new PdpProvider().createPdpGroups(pfDao, pdpGroups0.getGroups());
- }).hasMessageContaining("INVALID:pdpGroupState may not be null");
+ }).hasMessageContaining("PDP group").hasMessageContaining("pdpGroupState")
+ .hasMessageContaining(Validated.IS_NULL);
}
@Test
@@ -269,7 +271,8 @@ public class PdpProviderTest {
pdpGroups0.getGroups().get(0).setPdpGroupState(null);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpGroups(pfDao, pdpGroups0.getGroups());
- }).hasMessageContaining("INVALID:pdpGroupState may not be null");
+ }).hasMessageContaining("PDP group").hasMessageContaining("pdpGroupState")
+ .hasMessageContaining(Validated.IS_NULL);
}
@Test
@@ -375,7 +378,8 @@ public class PdpProviderTest {
existingSubGroup.setDesiredInstanceCount(-1);
assertThatThrownBy(() -> {
new PdpProvider().updatePdpSubGroup(pfDao, PDP_GROUP0, existingSubGroup);
- }).hasMessageContaining("INVALID:the desired instance count of a PDP sub group may not be negative");
+ }).hasMessageContaining("PDP sub group").hasMessageContaining("desiredInstanceCount")
+ .hasMessageContaining("is negative");
existingSubGroup.setDesiredInstanceCount(10);
}
@@ -473,7 +477,7 @@ public class PdpProviderTest {
existingPdp.setMessage("");
assertThatThrownBy(() -> {
new PdpProvider().updatePdp(pfDao, PDP_GROUP0, "APEX", existingPdp);
- }).hasMessageContaining("INVALID:message may not be blank");
+ }).hasMessageContaining("PDP").hasMessageContaining("message").hasMessageContaining(Validated.IS_BLANK);
existingPdp.setMessage("A Message");
}
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 904e5f135..d8eeab44f 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +33,7 @@ import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.onap.policy.models.base.Validated;
import org.onap.policy.models.dao.DaoParameters;
import org.onap.policy.models.dao.PfDao;
import org.onap.policy.models.dao.PfDaoFactory;
@@ -141,11 +143,13 @@ public class PdpStatisticsProviderTest {
assertThatThrownBy(() -> {
new PdpStatisticsProvider().createPdpStatistics(pfDao, pdpStatisticsNullList);
- }).hasMessageContaining("pdp statictics \"NULL\" is not valid");
+ }).hasMessageContaining("pdp statistics").hasMessageContaining("key")
+ .hasMessageContaining(Validated.IS_A_NULL_KEY);
assertThatThrownBy(() -> {
new PdpStatisticsProvider().updatePdpStatistics(pfDao, pdpStatisticsNullList);
- }).hasMessageContaining("pdp statistics \"NULL:0.0.0:0\" is not valid");
+ }).hasMessageContaining("pdp statistics").hasMessageContaining("key")
+ .hasMessageContaining(Validated.IS_A_NULL_KEY);
}
@Test