package simplemvc;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

@RunWith(MockitoJUnitRunner.class)
public class ControllerTest {
    public static final String ANY_STRING = "any string";

    @Mock
    private Model model;

    @Mock
    private View view;

    @Test
    public void start_default_callsShow() throws Exception {
        Controller controller = make_controller();

        controller.start();

        verify(view).show();
    }

    @Test
    public void addAction_default_callsAdd() throws Exception {
        Controller controller = make_controller();
        String aString = ANY_STRING;

        controller.addAction(aString);

        verify(model).addDatum(aString);
    }

    @Test
    public void removeAction_default_callsRemove() throws Exception {
        Controller controller = make_controller();
        String aString = ANY_STRING;

        controller.removeAction(aString);

        verify(model).removeDatum(aString);
    }

    private Controller make_controller() {
        Controller controller = new Controller();
        controller.setModel(model);
        controller.setView(view);
        return controller;
    }
}
@@ -69,16 +69,48 @@
 unWith;%0A
+import org.mockito.InjectMocks;%0A
 import o
@@ -122,24 +122,24 @@
 ckito.Mock;%0A
-
 import org.m
@@ -451,16 +451,69 @@
  view;%0A%0A
+    @InjectMocks%0A    private Controller controller;%0A%0A
     @Tes
@@ -579,60 +579,8 @@
 n %7B%0A
-        Controller controller = make_controller();%0A%0A
     
@@ -718,59 +718,8 @@
 n %7B%0A
-        Controller controller = make_controller();%0A
     
@@ -924,59 +924,8 @@
 n %7B%0A
-        Controller controller = make_controller();%0A
     
@@ -993,32 +993,32 @@
 tion(aString);%0A%0A
+
         verify(m
@@ -1054,203 +1054,6 @@
    %7D
-%0A%0A    private Controller make_controller() %7B%0A        Controller controller = new Controller();%0A        controller.setModel(model);%0A        controller.setView(view);%0A        return controller;%0A    %7D
 %0A%7D

replace make method with InjectMock