### Question:
TokenDeletion { public CountDownLatch deleteBatch(Collection<String> tokens) throws CoreTokenException { CountDownLatch latch = new CountDownLatch(tokens.size()); ResultHandler<String, CoreTokenException> handler = new CountdownHandler(latch); for (String token : tokens) { queue.delete(token, handler); } return latch; } @Inject  TokenDeletion(TaskDispatcher queue); CountDownLatch deleteBatch(Collection<String> tokens);  }### Answer:
@Test public void shouldQueueEachTokenProvided() throws CoreTokenException { Collection<String> tokens = Arrays.asList("badger", "weasel", "ferret"); deletion.deleteBatch(tokens); verify(mockQueue, times(3)).delete(anyString(), any(ResultHandler.class)); }
@Test public void shouldReturnCountDownLatchThatCorrespondsToTokensProvided() throws CoreTokenException { Collection<String> tokens = Arrays.asList("badger", "weasel", "ferret"); assertThat(deletion.deleteBatch(tokens).getCount()).isEqualTo(tokens.size()); }