CompositeMonitoringView implements MonitoringView { @Override public void stopMonitoring(Collection<Monitorable<?>> monitorables) { for (MonitoringView monitoringView : monitoringViews) { monitoringView.stopMonitoring(monitorables); } } CompositeMonitoringView(MonitoringView... monitoringViews); @Override void startMonitoring(Collection<Monitorable<?>> monitorables); @Override void stopMonitoring(Collection<Monitorable<?>> monitorables); @Override /** * For a Composite view, isRunning() is true if any of the underlying views are still running */ boolean isRunning();  }
@Test public void stopMonitoringShouldStopAllViews() { compositeMonitoringView.stopMonitoring(monitorables); verify(monitoringView1).stopMonitoring(monitorables); verify(monitoringView2).stopMonitoring(monitorables); }