@Test
public void iterate() {

  Iterator<ProtocolProducer> iterator = mock(Iterator.class);
  ProtocolCollection protocolCollection = mock(ProtocolCollection.class);
  ProtocolProducer protocolProducer = mock(ProtocolProducer.class);
  when(iterator.hasNext()).thenReturn(true, false);
  when(protocolCollection.hasFreeCapacity()).thenReturn(true);
  when(protocolProducer.hasNextProtocols()).thenReturn(false);
  when(iterator.next()).thenReturn(protocolProducer);
  List<ProtocolProducer> list = Arrays.asList(protocolProducer);
  ParallelProtocolProducer parallelProtocolProducer =
      new ParallelProtocolProducer(list);
  parallelProtocolProducer.iterate(iterator, protocolCollection);
  verify(iterator, times(1)).remove();
}