diff options
author | Wojciech Sliwka <wojciech.sliwka@nokia.com> | 2019-03-13 09:34:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-13 09:34:30 +0000 |
commit | 65e4018a72e97fbab04ad842381831deeba74628 (patch) | |
tree | b76710cc0394dc73c6c0578f50692f74e20bd289 | |
parent | 74216e2d089b1d2f13ba5fcdb3877e519df030e4 (diff) | |
parent | a035aefb6f6357bcc08202928e958f5dfeabb317 (diff) |
Merge "junits for PombaClientImpl"
-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); |