@Test
public void canDeserializeSuccessResponse() throws IOException {

    // given
    TestResult testResult = new TestResult();
    testResult.errors = false;
    testResult.took = new Random().nextInt(1000);
    BufferedBulk.Builder builder = createDefaultTestMockedBuilder();
    builder.withObjectReader(new BufferedBulkOperations(mock(PooledItemSourceFactory.class)).configuredReader());
    BufferedBulk bulk = builder.build();
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
    InputStream inputStream = new ByteArrayInputStream(mapper.writeValueAsBytes(testResult));
    // when
    BufferedBulkResult result = bulk.deserializeResponse(inputStream);
    // then
    assertTrue(result.isSucceeded());
    assertEquals(testResult.took, result.getTook());
}