Created
June 14, 2015 18:10
-
-
Save caseyscarborough/60028ca3cbc33cd78d52 to your computer and use it in GitHub Desktop.
Mockito Example
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
public class DomainBlackListTest extends MockedTester { | |
@Mock public EventBus eb; | |
@Mock public EventBusSingleton eventBus; | |
@Before public void initMocks() { | |
when(eventBus.getEventBus()) | |
.thenReturn(eb); | |
} | |
@Test public void simple() { | |
DomainBlackList d = new DomainBlackList(eventBus); | |
// ..... | |
} | |
} |
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
public class MockedTester { | |
public MockedTester() { | |
MockitoAnnotations.initMocks(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment