Last active
October 3, 2017 11:43
-
-
Save baybatu/ec8cf3c0229667536f79d8bd79057f23 to your computer and use it in GitHub Desktop.
Specifying behaviour when different parameters passed to mock object method call in Mockito
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
// Cover all `otherwise` cases first | |
doThrow(new IllegalArgumentException()).when(mockMessageSource).getMessage(any(String.class), any(Locale.class)); | |
// after that specify requested legal case | |
doReturn("Merhaba Hayye").when(mockMessageSource).getMessage("hello.message.key", new Locale("tr")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment