@Test
public void failoverIsNotExecutedAfterSuccessfulRequest() {

    // given
    BufferedJestHttpObjectFactory.Builder builder = createTestObjectFactoryBuilder();
    BufferedJestHttpObjectFactory config = spy(builder.build());
    ItemSource<ByteBuf> payload1 = createDefaultTestBuffereItemSource("test1");
    ItemSource<ByteBuf> payload2 = createDefaultTestBuffereItemSource("test2");
    Bulk bulk = createTestBatch(payload1, payload2);
    Function<Bulk, Boolean> failoverHandler = mock(Function.class);
    JestResultHandler<JestResult> resultHandler = config.createResultHandler(bulk, failoverHandler);
    JestResult result = mock(JestResult.class);
    when(result.isSucceeded()).thenReturn(true);
    // when
    resultHandler.completed(result);
    // then
    verify(failoverHandler, never()).apply(Mockito.any(Bulk.class));
}