@Test
public void testDeadWriterDetectionOnFlushCmdSend() throws Throwable {

  HTTPBulkLoader loader = getBulkLoader();
  loader.writerFuture = mock(Future.class);
  when(loader.writerFuture.isDone()).thenReturn(true);
  when(loader.writerFuture.get()).thenThrow(new RuntimeException("TEST"));
  HTTPBulkLoader.ActionRequest req = getRequest();
  loader.addAction("test", req); //this should not fail b/c queue is not yet full
  //This should fail b/c queue is full
  assertThatThrownBy(loader::flush).isInstanceOf(RuntimeException.class)
          .hasMessageContaining("TEST");
}