@Test
public void no_value_inserted_when_not_enough_requests() {

    // Create Mocks:
    Client mockedTransportClient = mock(Client.class);
    BulkProcessor.Listener mockedBulkProcessorListener = mock(BulkProcessor.Listener.class);
    // Configure the BulkProcessor to use:
    BulkProcessorConfiguration configuration = new BulkProcessorConfiguration(new BulkProcessingOptionsBuilder().build(), mockedBulkProcessorListener);
    // And create a fake index builder:
    IndexRequestBuilder indexRequestBuilder = new IndexRequestBuilder(mockedTransportClient, IndexAction.INSTANCE);
    // The mapping to use:
    IElasticSearchMapping localWeatherDataMapper = new LocalWeatherDataMapper();
    // Index to insert to:
    String indexName = "weather_data";
    // Initialize it with the default settings:
    when(mockedTransportClient.settings())
            .thenReturn(Settings.builder().build());
    when(mockedTransportClient.prepareIndex())
            .thenReturn(indexRequestBuilder);
    // Create the Test subject:
    ElasticSearchClient<LocalWeatherData> elasticSearchClient = new ElasticSearchClient<>(mockedTransportClient, indexName, localWeatherDataMapper, configuration);
    // Create more entities, than Bulk insertion threshold:
    Stream<LocalWeatherData> entitiesStream = getData(configuration.getBulkProcessingOptions().getBulkActions() - 1).stream();
    // Index the Data:
    elasticSearchClient.index(entitiesStream);
    // Verify, that the TransportClient bulk insert has been called:
    verify(mockedTransportClient, times(0)).bulk(anyObject(), anyObject());
    verify(mockedBulkProcessorListener, times(0)).beforeBulk(anyLong(), anyObject());
}