import javax.ws.rs.core.Response;
import org.junit.Test;
+import org.onap.policy.models.errors.concepts.ErrorResponse;
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"));
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());
}
}