CompositeMonitoringView implements MonitoringView { @Override public boolean isRunning() { return Iterators.any(monitoringViews.iterator(), new Predicate<MonitoringView>() { @Override public boolean apply(MonitoringView mv) { return mv.isRunning(); } }); } 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 isRunningReturnsTrueIfAnyRunning() { assertTrue(compositeMonitoringView.isRunning()); }
@Test public void isRunningReturnsFalseIfAllAreNotRunning() { CompositeMonitoringView monitoringView = new CompositeMonitoringView(monitoringView1); assertFalse(monitoringView.isRunning()); }