### Question:
FactConsumer implements TransactionalConsumer<FactSEB> { @Override public void consume(Collection<FactSEB> items) { if (CollectionUtils.isEmpty(items)) return; for (FactSEB seb : items) { FactDocument document = factConverter.apply(seb); if (document != null) { LOGGER.debug("Indexing Fact with id = %s into ElasticSearch.", document.getId()); factSearchManager.indexFact(document); } } } @Inject  FactConsumer(FactSearchManager factSearchManager, FactConverter factConverter); @Override void consume(Collection<FactSEB> items); @Override void close();  }### Answer:
@Test public void testConsumeNothing() { factConsumer.consume(null); factConsumer.consume(SetUtils.set()); verifyNoInteractions(factConverter); verifyNoInteractions(factSearchManager); }
@Test public void testConsumeSkipsNullElements() { FactSEB fact = FactSEB.builder().build(); factConsumer.consume(SetUtils.set(fact)); verify(factConverter).apply(fact); verifyNoInteractions(factSearchManager); }
@Test public void testConsumeIndexesFacts() { when(factConverter.apply(any())).thenReturn(new FactDocument()); factConsumer.consume(SetUtils.set(FactSEB.builder().build(), FactSEB.builder().build(), FactSEB.builder().build())); verify(factConverter, times(3)).apply(notNull()); verify(factSearchManager, times(3)).indexFact(notNull()); }