@Test
public void testFlush() throws SolrServerException, IOException {

    SolrInputDocument docA = mock(SolrInputDocument.class);
    SolrInputDocument docB = mock(SolrInputDocument.class);
    bufferedWriter.add(-1, ImmutableMap.of("a", docA));
    bufferedWriter.flush();
    verify(delegateWriter).add(eq(-1), eq(ImmutableMap.of("a", docA)));
    bufferedWriter.add(-1, ImmutableMap.of("b", docB));
    bufferedWriter.flush();
    verify(delegateWriter).add(eq(-1), eq(ImmutableMap.of("b", docB)));
    verify(docCounter, times(2)).increment(1L);
}