package dk.kleistsvendsen;

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

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;

public class GameTimerTest {
    private GameTimer gameTimer;

    @Mock
    private ITicSource ticSource;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
        TestGuiceModule module = new TestGuiceModule();
        module.addBinding(ITicSource.class, ticSource);
        TestGuiceModule.setUp(this, module);
        gameTimer = new GameTimer();
    }

    @After
    public void teardown() {
        TestGuiceModule.tearDown();
    }

    @Test
    public void testCallsTickOnStartTimer() {
        when(ticSource.tic()).thenReturn(0L);
        gameTimer.startTimer();
    }

    @Test
    public void testStartThenTimeLeft() {
        when(ticSource.tic()).thenReturn(0L);
        gameTimer.startTimer();
        when(ticSource.tic()).thenReturn(1000L);
        assertThat(gameTimer.timeLeft(), equalTo(1000L));
    }
}

@@ -93,16 +93,49 @@
 t.Test;%0A
+import org.junit.runner.RunWith;%0A
 import o
@@ -194,141 +194,86 @@
 ns;%0A
-%0A
 import 
-static org.hamcrest.CoreMatchers.equalTo;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.mockito.Mockito.when;%0A
+org.robolectric.RobolectricTestRunner;%0A%0A@RunWith(RobolectricTestRunner)
 %0Apub

Add @RunWith(Robolectric...)