summaryrefslogtreecommitdiffstats
path: root/common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/test')
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java18
-rw-r--r--common/src/test/resources/__files/aai/error-message.json1
2 files changed, 19 insertions, 0 deletions
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index a55fbc9517..73fbff6e4f 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -35,6 +35,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
+import javax.ws.rs.BadRequestException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -207,6 +208,23 @@ public class AAIResourcesClientTest {
}
@Test
+ public void verifyFailedCallException() {
+ AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
+ wireMockRule.stubFor(get(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "text/plain")
+ .withBodyFile("aai/error-message.json")
+ .withStatus(400)));
+ AAIResourcesClient client= aaiClient;
+
+ thrown.expect(BadRequestException.class);
+ thrown.expectMessage(containsString("Invalid input performing PUT on url (msg=Precondition Required:resource-version not passed for update of url"));
+ AAIResultWrapper result = client.get(path);
+ }
+
+ @Test
public void buildRelationshipTest() {
AAIResourcesClient client = aaiClient;
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
diff --git a/common/src/test/resources/__files/aai/error-message.json b/common/src/test/resources/__files/aai/error-message.json
new file mode 100644
index 0000000000..155232294a
--- /dev/null
+++ b/common/src/test/resources/__files/aai/error-message.json
@@ -0,0 +1 @@
+{"requestError":{"serviceException":{"messageId":"SVC3000","text":"Invalid input performing %1 on %2 (msg=%3) (ec=%4)","variables":["PUT","url","Precondition Required:resource-version not passed for update of url","ERR.5.4.6130"]}}} \ No newline at end of file