Created
October 8, 2013 16:22
-
-
Save dannyduc/6887307 to your computer and use it in GitHub Desktop.
Sample setup for Mockito test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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