### Question:
ApiResponse { public boolean isSuccess() { return httpResponseCode >= 200 && httpResponseCode < 300; } ApiResponse(int httpCode); int getResponseCode(); boolean isSuccess(); boolean isUnauthorized();  }### Answer:
@Test public void isSuccess_shouldReturnTrueIfResponseCodeIsInThe200Range() throws Exception { assertThat(new TestApiResponse(200, asStream(GENERIC_XML)).isSuccess(), equalTo(true)); assertThat(new TestApiResponse(201, asStream(GENERIC_XML)).isSuccess(), equalTo(true)); assertThat(new TestApiResponse(299, asStream(GENERIC_XML)).isSuccess(), equalTo(true)); }
@Test public void isSuccess_shouldReturnFalseIfResponseCodeIsIn500Range() throws Exception { assertThat(new TestApiResponse(500, asStream(GENERIC_XML)).isSuccess(), equalTo(false)); assertThat(new TestApiResponse(501, asStream(GENERIC_XML)).isSuccess(), equalTo(false)); }