aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java b/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java
index e8ddd821..55c6f3d4 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestProviderBase.java
@@ -151,6 +151,17 @@ public class TestProviderBase extends ProviderSuper {
}
@Test
+ public void testGetPolicy_NotFound() throws Exception {
+ when(dao.getFilteredPolicyList(any())).thenReturn(Collections.emptyList());
+
+ assertThatThrownBy(() -> prov.process(loadRequest(), this::handle)).isInstanceOf(PfModelRuntimeException.class)
+ .hasMessage("cannot find policy: policyA 1.2.3").matches(thr -> {
+ PfModelRuntimeException exc = (PfModelRuntimeException) thr;
+ return (exc.getErrorResponse().getResponseCode() == Status.NOT_FOUND);
+ });
+ }
+
+ @Test
public void testGetGroup() throws Exception {
when(dao.getFilteredPdpGroups(any())).thenReturn(loadGroups("getGroupDao.json"))
.thenReturn(loadGroups("groups.json"));