CompositeAppStateListener implements AppStateListener { @Override public void onAppDidEnterBackground() { for (AppStateListener listener : listeners) { listener.onAppDidEnterBackground(); } }  @Override void onAppDidEnterForeground(); @Override void onAppDidEnterBackground();  }
@Test public void notifiesListenersOfBackground() { compositeListener.onAppDidEnterBackground(); verify(listener1).onAppDidEnterBackground(); verify(listener2).onAppDidEnterBackground(); verify(listener3).onAppDidEnterBackground(); }