summaryrefslogtreecommitdiffstats
path: root/models-base/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'models-base/src/test/java/org')
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java9
-rw-r--r--models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java11
2 files changed, 12 insertions, 8 deletions
diff --git a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
index 0a5b6a0a6..664e3ddbc 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java
@@ -28,6 +28,7 @@ import java.io.IOException;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.onap.policy.models.errors.concepts.ErrorResponse;
public class ExceptionsTest {
@@ -41,7 +42,8 @@ public class ExceptionsTest {
String key = "A String";
PfModelException ae =
new PfModelException(Response.Status.OK, "Message", new IOException("IO exception message"), key);
- assertEquals("Message\ncaused by: Message\ncaused by: IO exception message", ae.getCascadedMessage());
+ ErrorResponse errorResponse = ae.getErrorResponse();
+ assertEquals("Message\nIO exception message", String.join("\n", errorResponse.getErrorDetails()));
assertEquals(key, ae.getObject());
assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message"));
@@ -52,8 +54,9 @@ public class ExceptionsTest {
String rkey = "A String";
PfModelRuntimeException re = new PfModelRuntimeException(Response.Status.OK, "Runtime Message",
new IOException("IO runtime exception message"), rkey);
- assertEquals("Runtime Message\ncaused by: Runtime Message\ncaused by: IO runtime exception message",
- re.getCascadedMessage());
+ errorResponse = re.getErrorResponse();
+ assertEquals("Runtime Message\nIO runtime exception message",
+ String.join("\n", errorResponse.getErrorDetails()));
assertEquals(key, re.getObject());
}
}
diff --git a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java
index 1257975ad..183b44c13 100644
--- a/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java
+++ b/models-base/src/test/java/org/onap/policy/models/base/PfModelExceptionInfoTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.onap.policy.models.errors.concepts.ErrorResponseInfo;
/**
* Test PfModelExceptionInfo interface.
@@ -49,15 +50,15 @@ public class PfModelExceptionInfoTest {
}
}
- private String getErrorMessage(final PfModelExceptionInfo pfme) {
+ private String getErrorMessage(final ErrorResponseInfo eri) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Server returned: ");
- stringBuilder.append(pfme.getStatusCode().toString());
+ stringBuilder.append(eri.getErrorResponse().getResponseCode().toString());
+ stringBuilder.append("Error Message:\n");
+ stringBuilder.append(eri.getErrorResponse().getErrorMessage());
stringBuilder.append("\nDetailed Message:\n");
- stringBuilder.append(pfme.getCascadedMessage());
- stringBuilder.append("\nStack Trace:\n");
- stringBuilder.append(pfme.getStackTraceAsString());
+ stringBuilder.append(String.join("\n", eri.getErrorResponse().getErrorDetails()));
return stringBuilder.toString();
}