use of org.jboss.resteasy.spi.DefaultOptionsMethodException in project resteasy by resteasy.
the class SegmentTest method testDefaultOptions.
/**
* @tpTestDetails Check default option for segment
* @tpSince RESTEasy 3.0.16
*/
@Test
public void testDefaultOptions() throws URISyntaxException {
ResourceMethodRegistry registry = new ResourceMethodRegistry(ResteasyProviderFactory.getInstance());
registry.addPerRequestResource(SegmentResource.class);
try {
ResourceInvoker invoker = registry.getResourceInvoker(MockHttpRequest.options("/resource/sub"));
} catch (DefaultOptionsMethodException e) {
}
try {
ResourceInvoker invoker = registry.getResourceInvoker(MockHttpRequest.put("/resource/sub"));
} catch (NotAllowedException e) {
}
}
use of org.jboss.resteasy.spi.DefaultOptionsMethodException in project candlepin by candlepin.
the class DefaultOptionsMethodExceptionMapperTest method exceptionWithResponse.
@Test
public void exceptionWithResponse() {
Response mockr = mock(Response.class);
when(mockr.getStatus()).thenReturn(500);
DefaultOptionsMethodException dome = new DefaultOptionsMethodException("oops", mockr);
DefaultOptionsMethodExceptionMapper domem = injector.getInstance(DefaultOptionsMethodExceptionMapper.class);
Response r = domem.toResponse(dome);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus());
assertEquals(mockr, r);
assertEquals("oops", dome.getMessage());
}
use of org.jboss.resteasy.spi.DefaultOptionsMethodException in project candlepin by candlepin.
the class DefaultOptionsMethodExceptionMapperTest method verifyResponse.
@Test
public void verifyResponse() {
DefaultOptionsMethodException dome = new DefaultOptionsMethodException("oops", null);
DefaultOptionsMethodExceptionMapper domem = injector.getInstance(DefaultOptionsMethodExceptionMapper.class);
Response r = domem.toResponse(dome);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus());
verifyMessage(r, rtmsg("oops"));
}
use of org.jboss.resteasy.spi.DefaultOptionsMethodException in project candlepin by candlepin.
the class RuntimeExceptionMapperTest method defaultOptionsException.
@Ignore
@Test
public void defaultOptionsException() {
Response forex = mock(Response.class);
when(req.getHeader(HttpHeaderNames.ACCEPT)).thenReturn("application/json");
Response r = rem.toResponse(new DefaultOptionsMethodException("", forex));
assertEquals(forex, r);
}
use of org.jboss.resteasy.spi.DefaultOptionsMethodException in project candlepin by candlepin.
the class DefaultOptionsMethodExceptionMapperTest method verifyResponse.
@Test
public void verifyResponse() {
DefaultOptionsMethodException dome = new DefaultOptionsMethodException("oops", null);
DefaultOptionsMethodExceptionMapper domem = injector.getInstance(DefaultOptionsMethodExceptionMapper.class);
Response r = domem.toResponse(dome);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), r.getStatus());
verifyMessage(r, rtmsg("oops"));
}
Aggregations