ForcedErrorResponse { public int getStatus() { int result = status; if (status > 0) { if (skip.getAndDecrement() <= 0) { if (count.getAndDecrement() <= 0) { result = status = -1; } } else { result = 0; } } return result; } ForcedErrorResponse(String info); int getStatus(); URI getResponseBody(); @Override String toString();  }
@Test public void testGetStatus() throws Exception{ ForcedErrorResponse test = new ForcedErrorResponse("500"); Assert.assertEquals(500, test.getStatus()); Assert.assertEquals(-1, test.getStatus()); Assert.assertEquals(-1, test.getStatus()); test = new ForcedErrorResponse("500 2"); Assert.assertEquals(500, test.getStatus()); Assert.assertEquals(500, test.getStatus()); Assert.assertEquals(-1, test.getStatus()); Assert.assertEquals(-1, test.getStatus()); test = new ForcedErrorResponse("500 2 1"); Assert.assertEquals(0, test.getStatus()); Assert.assertEquals(500, test.getStatus()); Assert.assertEquals(500, test.getStatus()); Assert.assertEquals(-1, test.getStatus()); Assert.assertEquals(-1, test.getStatus()); }