aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-17 16:54:52 +0530
committerSandeep Jha <sandeejh@in.ibm.com>2018-09-18 15:56:18 +0000
commit6dc2a63d4ed8324058b4ee527ff438a6b97094d8 (patch)
tree41763c02fea87aca52eef74c4928fe6fca998c9a /mso-api-handlers/mso-api-handler-common/src/test/java/org/onap
parent7f14f0c2cb879573709b687697636095e134b231 (diff)
added test case to ResponseHandlerTest.java
to increase code coverage Issue-ID: SO-153 Change-Id: I0829b1c49756eb5f30a618d3ef7d22dbb242126d Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/test/java/org/onap')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
index 117c8a2c27..0d4778b5b6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -17,7 +19,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.apihandler.common;
@@ -27,8 +29,6 @@ import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
@@ -38,13 +38,7 @@ import org.apache.http.message.BasicStatusLine;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.so.apihandler.common.ErrorNumbers;
-import org.onap.so.apihandler.common.ResponseHandler;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
-import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
/**
@@ -68,13 +62,27 @@ public class ResponseHandlerTest{
HttpResponse response = createResponse (200, body, "application/json");
ResponseHandler respHandler = new ResponseHandler (response, 1);
-
+
int status = respHandler.getStatus ();
assertEquals (status, HttpStatus.SC_ACCEPTED);
assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process");
}
+
+ @Test
+ public void tesParseCamundaResponseForCamundaTaskType () throws ApiException {
+ String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
+ + "\"message\": \"Successfully started the process\"}";
+ HttpResponse response = createResponse (200, body, "application/json");
+
+ ResponseHandler respHandler = new ResponseHandler (response, 2);
+
+ int status = respHandler.getStatus ();
+ assertEquals (status, HttpStatus.SC_ACCEPTED);
+ assertEquals (respHandler.getResponseBody(), body);
+
+ }
@Test
public void tesParseBpelResponse () throws ApiException{
String body = "<test:service-response xmlns:test=\"http://org.onap/so/test\">"
@@ -99,7 +107,7 @@ public class ResponseHandlerTest{
thrown.expectMessage(startsWith("Cannot parse Camunda Response"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
-
+
HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
ResponseHandler respHandler = new ResponseHandler (response, 1);