@Test
public void testListeners() {

    final StatusUpdateListener listener1 = EasyMock.createMock(StatusUpdateListener.class);
    final StatusUpdateListener listener2 = EasyMock.createMock(StatusUpdateListener.class);
    final StatusUpdateListener listener3 = EasyMock.createMock(StatusUpdateListener.class);
    final ControlledDependency dependency = ControlledDependency.build();
    dependency.setInError(true);
    final DependencyPinger pinger = new DependencyPinger(MoreExecutors.newDirectExecutorService(), dependency, systemReporter);
    pinger.addListener(listener1);
    pinger.addListener(listener2);
    pinger.addListener(listener3);
    final Iterator<StatusUpdateListener> actual = pinger.listeners();
    assertEquals(ImmutableList.of(listener1, listener2, listener3), Arrays.asList(Iterators.toArray(actual, StatusUpdateListener.class)));
    // verify no ConcurrentModificationException
    for (final Iterator<StatusUpdateListener> it = pinger.listeners(); it.hasNext() ; it.next()) {
        pinger.addListener(EasyMock.createMock(StatusUpdateListener.class));
    }
}