@GET @Path("/infinite-forward") @Produces("text/plain") public int infinitFoward( @Context InternalDispatcher dispatcher, @QueryParam("count") @DefaultValue("0") int count) { uriStack.push(uriInfo.getAbsolutePath().toString()); try { dispatcher.getEntity("/infinite-forward?count=" + (count + 1)); // we'll never reach 20, since the max count of times through the // system is 20, and first time through is 0 Assert.assertNotSame(20, count); } catch (BadRequestException e) { } finally { Assert.assertEquals(count, MessageBodyParameterInjector.bodyCount()); Assert.assertEquals(count + 1, ResteasyProviderFactory.getContextDataLevelCount()); } return ResteasyProviderFactory.getContextDataLevelCount(); }