Created
November 24, 2014 15:37
-
-
Save xCASx/2ee243ec4c4c59e215e7 to your computer and use it in GitHub Desktop.
Mockito fixture template
This file contains 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
/** | |
* Fixture for test. | |
*/ | |
private static final class Fixture { | |
@Mock | |
CustomManager customManager; | |
@Mock | |
CustomRepository repository; | |
@Mock | |
CustomSorter sorter; | |
@Spy | |
@InjectMocks | |
CustomController controller = new CustomController(); | |
Fixture() { | |
MockitoAnnotations.initMocks(this); | |
// do some general inits | |
} | |
void givenCustomManager(CustomDTO customDTO) { | |
doReturn(customDTO).when(customManager).manage(anyLong(), any(Date.class)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment