summaryrefslogtreecommitdiffstats
path: root/models-provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'models-provider/src/test')
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java10
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java12
2 files changed, 18 insertions, 4 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
index 7ad221721..8a83f4414 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.models.provider.impl;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -311,13 +312,14 @@ public class DatabasePolicyModelsProviderTest {
databaseProvider.deleteGuardPolicy("policy_id");
}).hasMessage("no policy found for policy ID: policy_id");
- assertThatThrownBy(() -> {
- databaseProvider.getPdpGroups("name", "version");
- }).hasMessage("PDP group not found: name:version");
+ assertEquals(0, databaseProvider.getPdpGroups("name", "version").size());
assertNotNull(databaseProvider.createPdpGroups(new ArrayList<>()));
assertNotNull(databaseProvider.updatePdpGroups(new ArrayList<>()));
- assertNotNull(databaseProvider.deletePdpGroup("name", "version"));
+
+ assertThatThrownBy(() -> {
+ databaseProvider.deletePdpGroup("name", "version");
+ }).hasMessage("delete of PDP group \"name:version\" failed, PDP group does not exist");
} catch (Exception exc) {
LOGGER.warn("test should not throw an exception", exc);
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
index c64603d9a..69b7a0f71 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
@@ -30,6 +30,7 @@ import lombok.NonNull;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroup;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
@@ -159,6 +160,11 @@ public class DummyBadProviderImpl implements PolicyModelsProvider {
}
@Override
+ public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
+ @NonNull String pdpSubGroup, @NonNull Pdp pdp) throws PfModelException {
+ }
+
+ @Override
public PdpGroup deletePdpGroup(@NonNull String name, @NonNull String verison) throws PfModelException {
return null;
}
@@ -184,6 +190,12 @@ public class DummyBadProviderImpl implements PolicyModelsProvider {
}
@Override
+ public ToscaServiceTemplate getPolicies4PolicyType(@NonNull String policyTypeName, String policyTypeVersion)
+ throws PfModelException {
+ return null;
+ }
+
+ @Override
public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull String policyTypeName, final String policyTypeVersion)
throws PfModelException {
return null;