use of ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.OnWriteExceptionThrowingStringBean in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method proceedThrowsWebApplicationExceptionTest.
/*
* @testName: proceedThrowsWebApplicationExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:936; JAXRS:JAVADOC:1009; JAXRS:JAVADOC:930;
*
* @test_Strategy: Proceed to the next interceptor in the chain.
* Throws:WebApplicationException - thrown by the wrapped {@code
* MessageBodyWriter.writeTo} method.
*
* proceed is actually called in every clientwriter.writerinterceptorcontext
* test
*
* WriterInterceptor.aroundWriteTo
*/
@Test
public void proceedThrowsWebApplicationExceptionTest() throws Fault {
addProvider(StringBeanEntityProvider.class);
addHeader(TemplateInterceptorBody.OPERATION, ContextOperation.PROCEEDTHROWSWEBAPPEXCEPTION.name());
setRequestContentEntity(new OnWriteExceptionThrowingStringBean(TemplateInterceptorBody.ENTITY));
try {
invoke();
} catch (Exception e) {
ProceedException p = assertCause(e, ProceedException.class, "Proceed did not throw exception");
assertContains(p.getMessage(), TemplateInterceptorBody.WAE, "Unexpected message received", p.getMessage());
logMsg(p.getMessage());
}
}
use of ee.jakarta.tck.ws.rs.ee.rs.ext.interceptor.writer.writerinterceptorcontext.OnWriteExceptionThrowingStringBean in project jaxrs-api by eclipse-ee4j.
the class Resource method genericResponse.
@GET
@Path("{id}")
public Response genericResponse(@PathParam("id") String path) {
ContextOperation op = ContextOperation.valueOf(path.toUpperCase());
ResponseBuilder builder = createResponseBuilderWithHeader(op);
switch(op) {
case GETHEADERS:
for (int i = 0; i != 5; i++) builder = builder.header(TemplateInterceptorBody.PROPERTY + i, "any");
break;
case PROCEEDTHROWSWEBAPPEXCEPTION:
builder.entity(new OnWriteExceptionThrowingStringBean(TemplateInterceptorBody.ENTITY));
break;
default:
break;
}
Response response = builder.build();
return response;
}
Aggregations