diff options
Diffstat (limited to 'vid-app-common/src/test/java')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/aai/PombaClientImplTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/PombaClientImplTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/PombaClientImplTest.java index 222bf1e5b..c41a479d9 100644 --- a/vid-app-common/src/test/java/org/onap/vid/aai/PombaClientImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/aai/PombaClientImplTest.java @@ -19,6 +19,7 @@ */ package org.onap.vid.aai; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.then; @@ -60,6 +61,20 @@ public class PombaClientImplTest { then(pombaRestInterface).should().RestPost("VidAaiController", expectedUrl, expectedPayload); } + @Test + public void should_handleException_withoutRethrowing() throws IOException { + //Given + String expectedUrl = "http://localhost/dummyUrl"; + String expectedPayload = readExpectedPombaJsonRequest(); + given(systemPropertiesWrapper.getProperty("pomba.server.url")).willReturn(expectedUrl); + given(pombaRestInterface.RestPost("VidAaiController", expectedUrl, expectedPayload)) + .willThrow(new NullPointerException()); + PombaRequest pombaRequest = createPombaRequest(); + + //When //Then + assertThatCode(() -> pombaClient.verify(pombaRequest)).doesNotThrowAnyException(); + } + private String readExpectedPombaJsonRequest() throws IOException { URL url = PombaClientImplTest.class.getClassLoader().getResource("pomba_request.json"); PombaRequest expectedPombaRequest = new ObjectMapper().readValue(url, PombaRequest.class); |