### Question:
Listeners implements Iterable<T> { @Deprecated public void remove( T listener ) { requireNonNull( listener, "removed listener can't be null" ); listeners.remove( listener ); } @Deprecated  Listeners(); @Deprecated  Listeners( Listeners<T> other ); @Deprecated void add( T listener ); @Deprecated void remove( T listener ); @Deprecated void notify( Notification<T> notification ); @Deprecated void notify( Executor executor, Notification<T> notification ); @Override Iterator<T> iterator();  }### Answer:
@Test void removeNull() { assertThrows( NullPointerException.class, () -> new Listeners<>().remove( null ) ); }
@Test void remove() { Listener listener1 = new Listener(); Listener listener2 = new Listener(); Listener listener3 = new Listener(); Listeners<Listener> listeners = newListeners( listener1, listener2, listener3 ); assertEquals( Arrays.asList( listener1, listener2, listener3 ), Iterables.asList( listeners ) ); listeners.remove( listener1 ); assertEquals( Arrays.asList( listener2, listener3 ), Iterables.asList( listeners ) ); listeners.remove( listener3 ); assertEquals( singletonList( listener2 ), Iterables.asList( listeners ) ); }