aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java')
-rw-r--r--src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
index 4d8713a..6b6c94d 100644
--- a/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
+++ b/src/test/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClientTest.java
@@ -153,7 +153,7 @@ public class CpsClientTest {
@Test
public void getRicIdTest() {
- String responseBody = "{\"idNearRTRIC\":\"22\"}";
+ String responseBody = "[{\"idNearRTRIC\":\"22\"}]";
PowerMockito.mockStatic(SonHandlerRestTemplate.class);
PowerMockito.mockStatic(Configuration.class);
PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
@@ -164,8 +164,10 @@ public class CpsClientTest {
try {
String result = cps.getRicId("1");
String response = ResponseEntity.ok(responseBody).getBody();
- JSONObject respObj = new JSONObject(response);
- assertEquals(respObj.get("idNearRTRIC"), result);
+ JSONArray requestArray = new JSONArray(response);
+ for (int i=0;i<requestArray.length();i++) {
+ assertEquals(requestArray.getJSONObject(i).getString("idNearRTRIC"), result);
+ }
} catch (CpsNotFoundException e) {
log.debug("CpsNotFoundException {}", e.toString());
}