Last active
September 17, 2019 18:25
-
-
Save tzachz/8f7522672827d1553ee2cfb173b7aa75 to your computer and use it in GitHub Desktop.
Mockito gotcha: usecase
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
before { | |
// default for most tests: | |
when(dependency.getValue(any())).thenAnswer(produceDefaultAnswer()) | |
} | |
"MyService.testedMethod" should "do something special" in { | |
// override default for this test: | |
when(dependency.getValue(any())).thenAnswer(produceSpecialAnswer()) | |
// continue test... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment