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.java14
1 files changed, 8 insertions, 6 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 e43a635..5b7050a 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
@@ -103,7 +103,7 @@ public class CpsClientTest {
@Test
public void getPciTest() {
- String responseBody = "{\n" + " \"nRPCI\": \"11\",\n" + " \"value\": 0\n" + "}";
+ String responseBody = "[{\n" + " \"nRPCI\": \"11\",\n" + " \"value\": 0\n" + "}]";
PowerMockito.mockStatic(SonHandlerRestTemplate.class);
PowerMockito.mockStatic(Configuration.class);
PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
@@ -115,8 +115,10 @@ public class CpsClientTest {
try {
int result = cps.getPci("1");
String response = ResponseEntity.ok(responseBody).getBody();
- JSONObject respObj = new JSONObject(response);
- assertEquals(respObj.getInt("nRPCI"), result);
+ JSONArray requestArray = new JSONArray(response);
+ for (int i=0;i<requestArray.length();i++) {
+ assertEquals(requestArray.getJSONObject(i).getInt("nRPCI"), result);
+ }
} catch (CpsNotFoundException e) {
log.debug("CpsNotFoundException {}", e.toString());
;
@@ -127,7 +129,7 @@ public class CpsClientTest {
@Test
public void getPnfNameTest() {
- String responseBody = "[{\n" + " \"idGNBCUCPFunction\": \"cucpserver1\",\n" + " \"value\": \"string\"\n" + "}]";
+ String responseBody = "[{\n" + " \"idGNBDUFunction\": \"110\",\n" + " \"value\": \"string\"\n" + "}]";
PowerMockito.mockStatic(SonHandlerRestTemplate.class);
PowerMockito.mockStatic(Configuration.class);
PowerMockito.when(Configuration.getInstance()).thenReturn(configuration);
@@ -136,12 +138,12 @@ public class CpsClientTest {
Matchers.<ParameterizedTypeReference<String>>any()))
.thenReturn(ResponseEntity.ok(responseBody));
try {
- String result = cps.getPnfName("cucpserver1");
+ String result = cps.getPnfName("110");
String response = ResponseEntity.ok(responseBody).getBody();
JSONArray requestArray = new JSONArray(response);
for (int i=0;i<requestArray.length();i++) {
- assertEquals(requestArray.getJSONObject(i).getString("idGNBCUCPFunction"), result);
+ assertEquals(requestArray.getJSONObject(i).getString("idGNBDUFunction"), result);
}
} catch (CpsNotFoundException e) {
log.debug("CpsNotFoundException {}", e.toString());