@Test
public void callingCompletedReleasesActions() {

    // given
    BatchRequest.Builder builder = createDefaultTestObjectBuilder();
    ByteBufItemSource buffer = mock(ByteBufItemSource.class);
    builder.withBuffer(buffer);
    BatchRequest request = builder.build();
    Collection<IndexRequest> actions = new ArrayList<>();
    IndexRequest indexRequest = spy(createIndexRequestBuilder(mock(ByteBufItemSource.class))
            .build());
    actions.add(indexRequest);
    builder.add(actions);
    // when
    request.completed();
    // then
    verify(indexRequest).release();
}