### Question:
BulkEmitterFactory implements BatchEmitterFactory<BulkEmitter> { @Override public BulkEmitter createInstance(int batchSize, int deliveryInterval, ClientObjectFactory clientObjectFactory, FailoverPolicy failoverPolicy) { BulkEmitter bulkEmitter = new BulkEmitter(batchSize, deliveryInterval, clientObjectFactory.createBatchOperations()); bulkEmitter.addListener(clientObjectFactory.createBatchListener(failoverPolicy)); return bulkEmitter; }  @Override boolean accepts(Class clientObjectFactoryClass); @Override BulkEmitter createInstance(int batchSize, int deliveryInterval, ClientObjectFactory clientObjectFactory, FailoverPolicy failoverPolicy);  }### Answer:
@Test public void createsBatchListener() { BatchEmitterFactory factory = new BulkEmitterFactory(); JestHttpObjectFactory clientObjectFactory = spy(createTestObjectFactoryBuilder().build()); NoopFailoverPolicy failoverPolicy = new NoopFailoverPolicy(); factory.createInstance(1, 1, clientObjectFactory, failoverPolicy); Mockito.verify(clientObjectFactory).createBatchListener(eq(failoverPolicy)); }
@Test public void createsBulkOperations() { BatchEmitterFactory factory = new BulkEmitterFactory(); JestHttpObjectFactory clientObjectFactory = spy(createTestObjectFactoryBuilder().build()); factory.createInstance(1, 1, clientObjectFactory, new NoopFailoverPolicy()); Mockito.verify(clientObjectFactory).createBatchOperations(); }
@Test public void createsBatchListener() { BatchEmitterFactory factory = new BulkEmitterFactory(); HCHttp clientObjectFactory = Mockito.spy(createDefaultHttpObjectFactoryBuilder().build()); NoopFailoverPolicy failoverPolicy = new NoopFailoverPolicy(); factory.createInstance(1, 1, clientObjectFactory, failoverPolicy); Mockito.verify(clientObjectFactory).createBatchListener(eq(failoverPolicy)); }
@Test public void createsBatchOperations() { BatchEmitterFactory factory = new BulkEmitterFactory(); HCHttp clientObjectFactory = Mockito.spy(createDefaultHttpObjectFactoryBuilder().build()); factory.createInstance(1, 1, clientObjectFactory, new NoopFailoverPolicy()); Mockito.verify(clientObjectFactory).createBatchOperations(); }