### Question:
BatchingIndexingServiceImpl extends AbstractIdleService implements BatchingIndexingService { @Override public ListenableFuture<Operation> deleteItem(Delete deleteItem) throws InterruptedException { AsyncRequest<Operation> itemDelete = new AsyncRequest<>(deleteItem, retryPolicy, operationStats); batchService.add(itemDelete); return itemDelete.getFuture(); } private  BatchingIndexingServiceImpl(Builder builder); @Override ListenableFuture<Operation> indexItem(Index indexItem); @Override ListenableFuture<Item> pushItem(Push pushItem); @Override ListenableFuture<Operation> deleteItem(Delete deleteItem); @Override ListenableFuture<Operation> unreserveItem(Unreserve unreserveItem); static BatchingIndexingService fromConfiguration(
      CloudSearch service, GoogleCredential credential);  }### Answer:
@Test public void testRequireServiceStarted() throws InterruptedException { BatchingIndexingService batchingService = getInstance(); thrown.expect(IllegalStateException.class); batchingService.deleteItem(deleteItemRequest); }
@Test public void testCanBatchAfterStarted() throws InterruptedException { BatchingIndexingService batchingService = getInstance(); batchingService.startAsync().awaitRunning(); assertTrue(batchingService.isRunning()); batchingService.deleteItem(deleteItemRequest); batchingService.stopAsync().awaitTerminated(); assertFalse(batchingService.isRunning()); }
@Test public void testCanNotBatchBatchAfterTerminated() throws InterruptedException { BatchingIndexingService batchingService = getInstance(); batchingService.startAsync().awaitRunning(); assertTrue(batchingService.isRunning()); batchingService.stopAsync().awaitTerminated(); thrown.expect(IllegalStateException.class); batchingService.deleteItem(deleteItemRequest); }