Search in sources :

Example 11 with ExceptionMessage

use of org.candlepin.common.exceptions.ExceptionMessage in project candlepin by candlepin.

the class JaxRsExceptionResponseBuilderTest method jaxWsRsError.

@Test
public void jaxWsRsError() {
    String foo = "javax.ws.rs.SomeThing(\"paramName\") value is 'strVal' for";
    Response resp = exceptionBuilder.getResponse(new RuntimeException(foo));
    ExceptionMessage e = (ExceptionMessage) resp.getEntity();
    assertTrue(exceptionBuilder.canHandle(new RuntimeException(foo)));
    assertTrue(e.getDisplayMessage().contains("paramName"));
    assertTrue(e.getDisplayMessage().contains("strVal"));
}
Also used : Response(javax.ws.rs.core.Response) ExceptionMessage(org.candlepin.common.exceptions.ExceptionMessage) Test(org.junit.Test)

Aggregations

ExceptionMessage (org.candlepin.common.exceptions.ExceptionMessage)11 Response (javax.ws.rs.core.Response)6 Test (org.junit.Test)6 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)4 CandlepinException (org.candlepin.common.exceptions.CandlepinException)3 CandlepinParameterParseException (org.candlepin.common.exceptions.CandlepinParameterParseException)2 IOException (java.io.IOException)1 Matcher (java.util.regex.Matcher)1 ConstraintViolation (javax.validation.ConstraintViolation)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 ConflictException (org.candlepin.common.exceptions.ConflictException)1 JaxRsExceptionResponseBuilder (org.candlepin.common.util.JaxRsExceptionResponseBuilder)1