NotAllowedExceptionMapper extends CandlepinExceptionMapper implements ExceptionMapper<NotAllowedException> { @Override public Response toResponse(NotAllowedException exception) { return getDefaultBuilder(exception, null, determineBestMediaType()).status(Response.Status.METHOD_NOT_ALLOWED).build(); }  @Override Response toResponse(NotAllowedException exception);  }
@Test public void handleMethodNotAllowed() { NotAllowedException mnae = new NotAllowedException("Not Allowed"); NotAllowedExceptionMapper mnaem = injector.getInstance(NotAllowedExceptionMapper.class); Response r = mnaem.toResponse(mnae); assertEquals(405, r.getStatus()); verifyMessage(r, rtmsg(".+ Not Allowed.*")); }