Skip to content

Instantly share code, notes, and snippets.

@dannyduc
Created October 8, 2013 16:22
Show Gist options
  • Save dannyduc/6887307 to your computer and use it in GitHub Desktop.
Save dannyduc/6887307 to your computer and use it in GitHub Desktop.
Sample setup for Mockito test
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.Mockito.*;
import static org.mockito.MockitoAnnotations.*;
@RunWith(MockitoJUnitRunner.class)
public class MyAppTest {
MyApp myApp;
@Mock
public MyService myServiceMock;
@Before
public void init() {
myApp = new MyApp(myServiceMock);
}
@Test
public void loadApp() {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment