aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java23
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java3
2 files changed, 25 insertions, 1 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java
index 10456bebf..cfde52a56 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoUtilTest.java
@@ -26,6 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import io.joshworks.restclient.http.HttpResponse;
import org.onap.vid.testUtils.TestUtils;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class MsoUtilTest {
@@ -67,4 +68,26 @@ public class MsoUtilTest {
assertThat(result.getStatus()).isEqualTo(SC_OK);
}
+ @DataProvider
+ public static Object[][] formatExceptionAdditionalInfo() {
+ return new Object[][]{
+ {"message", "Http Code:400, message"},
+
+ {null, "Http Code:400"},
+
+ {"{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC0002\",\"text\":\"message\"}}}",
+ "Http Code:400, \"messageId\":\"SVC0002\",\"text\":\"message\""},
+
+ {"{\"validJson\": \"Error: message\"}", "Http Code:400, {\"validJson\": \"Error: message\"}"},
+
+ {"{\"serviceException\":{\"messageId\":\"SVC0002\",\"text\":\"Error: message\"}}",
+ "Http Code:400, \"messageId\":\"SVC0002\",\"text\":\"Error: message\""},
+ };
+ }
+
+ @Test(dataProvider = "formatExceptionAdditionalInfo")
+ public void formatExceptionAdditionalInfo_payloadWithError400_doNotReturnNull(String payload, String expected) {
+ assertThat(MsoUtil.formatExceptionAdditionalInfo(400, payload))
+ .isEqualTo(expected);
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
index 0749aaf82..a1e4af2c4 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
@@ -1223,7 +1223,8 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT
String message = "Failed to create service instance";
return new Object[][]{
{500, message},
- {199, "{\"serviceException\":{\"messageId\":\"SVC2000\",\"text\":\"Error: " + message + "\"}}"}
+ {400, "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC0002\",\"text\":\"" + message + "\"}}}"},
+ {199, "{\"serviceException\":{\"messageId\":\"SVC2000\",\"text\":\"Error: " + message + "\"}}"},
};
}