summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java
diff options
context:
space:
mode:
authorTomasz Gwozdecki <tomasz.gwozdecki@nokia.com>2019-03-13 04:40:42 -0400
committerTomasz Gwozdecki <tomasz.gwozdecki@nokia.com>2019-03-13 04:40:42 -0400
commita035aefb6f6357bcc08202928e958f5dfeabb317 (patch)
tree976459ece0ac81dbf2afddf7552eb5584194f604 /vid-app-common/src/test/java
parent2393e29dd7bf80d6490d9e1561346aeff722a09c (diff)
junits for PombaClientImpl
-Added new test to check Exception handling Change-Id: I3ddd8ac2e6a3e77ebf751fed8e4bc0ca6cc61e2f Issue-ID: VID-418 Signed-off-by: Tomasz Gwozdecki <tomasz.gwozdecki@nokia.com>
Diffstat (limited to 'vid-app-common/src/test/java')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/PombaClientImplTest.java15
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);