package com.custardsource.parfait;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.Collection;

import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class CompositeMonitoringViewTest {

    @Mock
    MonitoringView monitoringView1;

    @Mock
    MonitoringView monitoringView2;

    CompositeMonitoringView compositeMonitoringView;

    @Mock
    Collection<Monitorable<?>> monitorables;

    @Before
    public void setUp() {

        MockitoAnnotations.initMocks(this);

        when(monitoringView1.isRunning()).thenReturn(false);
        when(monitoringView2.isRunning()).thenReturn(true);

        when(monitorables.size()).thenReturn(2);

        this.compositeMonitoringView = new CompositeMonitoringView(monitoringView1, monitoringView2);
    }

    @Test
    public void testStartMonitoring() {

        compositeMonitoringView.startMonitoring(monitorables);

        verify(monitoringView1).startMonitoring(monitorables);
        verify(monitoringView2).startMonitoring(monitorables);

    }

    @Test
    public void testStopMonitoring() {
        compositeMonitoringView.stopMonitoring(monitorables);

        verify(monitoringView1).stopMonitoring(monitorables);
        verify(monitoringView2).stopMonitoring(monitorables);
    }

    @Test
    public void testIsRunning() {
        assertTrue(compositeMonitoringView.isRunning());
    }
}

@@ -172,16 +172,60 @@
 ction;%0A%0A
+import static org.junit.Assert.assertFalse;%0A
 import s
@@ -259,16 +259,16 @@
 rtTrue;%0A
-
 import s
@@ -981,21 +981,17 @@
 ic void 
-testS
+s
 tartMoni
@@ -992,24 +992,43 @@
 rtMonitoring
+ShouldStartAllViews
 () %7B%0A%0A      
@@ -1249,13 +1249,9 @@
 oid 
-testS
+s
 topM
@@ -1259,16 +1259,34 @@
 nitoring
+ShouldStopAllViews
 () %7B%0A   
@@ -1506,14 +1506,33 @@
 oid 
-testIs
+isRunningReturnsTrueIfAny
 Runn
@@ -1601,11 +1601,232 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void isRunningReturnsFalseIfAllAreNotRunning() %7B%0A        CompositeMonitoringView monitoringView = new CompositeMonitoringView(monitoringView1);%0A        assertFalse(monitoringView.isRunning());%0A    %7D
 %0A%7D%0A

Make test names more readable and add missing test case (Cowan's review comments)