HomeController { @PermitAll @GET @Path("/error") @Produces("application/json") public Response error() throws Exception { throw new BizException("TEST", "test exception"); }  @RateLimiter(base = RateLimiter.Base.General, permits = 2, timeUnit = TimeUnit.MINUTES) @PermitAll @GET @Path("/world/{id}") @Produces("application/json") Response helloworld(@Context HttpHeaders headers); @PermitAll @GET @Path("/error") @Produces("application/json") Response error(); @PermitAll @POST @Path("/login") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) Response login(UserLogin userLogin); @PermitAll @AntiDefacement @POST @Path("/loginecho") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response loginecho(UserLogin userLogin); @RolesAllowed({ "USER", "MAIN_FORCES" }) @POST @Path("/singlesave") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response save(Article article); @RolesAllowed("MAIN_FORCES") @POST @Path("/multisave") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) List<Article> save(@QueryParam("multi") boolean isMulti, List<Article> articles);  }
@Test public void testError() { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(buildUrl("hello/error")); Response response = target.request().get(); assertEquals(response.getStatus(),Status.BAD_REQUEST.getStatusCode()); BizException bizExeption = response.readEntity(BizException.class); assertEquals("TEST",bizExeption.getCode()); assertEquals("test exception", bizExeption.getMsg()); response.close(); }