### Question:
BatchResult implements Response { public boolean isSucceeded() { return !this.errors && error == null; } BatchResult(int took, boolean errors, Error error, int statusCode, List<BatchItemResult> items); int getTook(); boolean isSucceeded(); Error getError(); int getStatusCode(); List<BatchItemResult> getItems(); @Override int getResponseCode(); @Override String getErrorMessage(); BatchResult withResponseCode(int responseCode); BatchResult withErrorMessage(String errorMessage);  }### Answer:
@Test public void isSucceededReturnsFalseWhenErrorsIsTrueAndErrorIsNull() { BatchResult result = createTestBatchResult(true, null); boolean succeeded = result.isSucceeded(); Assert.assertFalse(succeeded); }
@Test public void isSucceededReturnsFalseWhenErrorsIsFalseAndErrorIsNotNull() { BatchResult result = createTestBatchResult(false, new Error()); boolean succeeded = result.isSucceeded(); Assert.assertFalse(succeeded); }
@Test public void isSucceededReturnsFalseWhenErrorsIsTrueAndErrorIsNotNull() { BatchResult result = createTestBatchResult(true, new Error()); boolean succeeded = result.isSucceeded(); Assert.assertFalse(succeeded); }
@Test public void isSucceededReturnsTrueWhenErrorsIsFalseAndErrorIsNull() { BatchResult result = createTestBatchResult(false, null); boolean succeeded = result.isSucceeded(); Assert.assertTrue(succeeded); }