diff options
Diffstat (limited to 'a1-policy-management/src/test')
3 files changed, 5 insertions, 5 deletions
diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java index 91eb6333..9c9331da 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java @@ -283,13 +283,12 @@ class ApplicationTest { } @Test - void testAddingRicFromConfiguration_nonRespondingRic() throws ServiceException { + void testAddingRicFromConfiguration_nonRespondingRic() throws Exception { putService("service"); final String RIC = "NonRespondingRic"; MockA1Client a1Client = a1ClientFactory.getOrCreateA1Client(RIC); - WebClientResponseException a1Exception = new WebClientResponseException(404, "", null, null, null); - doReturn(Mono.error(a1Exception)).when(a1Client).getPolicyTypeIdentities(); + doReturn(MockA1Client.monoError("error", HttpStatus.BAD_GATEWAY)).when(a1Client).getPolicyTypeIdentities(); refreshConfigTask.handleUpdatedRicConfig( // new RicConfigUpdate(ricConfig(RIC, "me1"), RicConfigUpdate.Type.ADDED)) // diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java index 6192c932..030b831f 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationControllerTest.java @@ -135,7 +135,8 @@ class ConfigurationControllerTest { String url = "a1-policy/v2/configuration"; // Valid JSON but invalid configuration. - testErrorCode(restClient().put(url, "{\"error\":\"error\"}"), HttpStatus.BAD_REQUEST, "Faulty configuration"); + testErrorCode(restClient().put(url, "{\"error\":\"error\"}"), HttpStatus.BAD_REQUEST, + "Missing root configuration"); } private void testErrorCode(Mono<?> request, HttpStatus expStatus, String responseContains) { diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java index 22ac2437..2a3b28ef 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/utils/MockA1Client.java @@ -124,7 +124,7 @@ public class MockA1Client implements A1Client { } } - Mono<String> monoError(String responseBody, HttpStatus status) { + public static Mono<String> monoError(String responseBody, HttpStatus status) { byte[] responseBodyBytes = responseBody.getBytes(StandardCharsets.UTF_8); WebClientResponseException a1Exception = new WebClientResponseException(status.value(), status.getReasonPhrase(), null, responseBodyBytes, StandardCharsets.UTF_8, null); |