Created
January 10, 2015 13:21
-
-
Save javaeeeee/39a5e30180f1ae659bfd to your computer and use it in GitHub Desktop.
A Mockito test simulating exception
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
@Test | |
public void testShowBalance() throws BankServiceException { | |
//given | |
Mockito.when(bankService.getBalance()) | |
.thenThrow(new BankServiceException()); | |
//when | |
sut.showBalance(); | |
//then | |
Mockito.verify(screen).displayError(ATM.BANK_SERVICE_ERROR); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment