Created
February 22, 2017 10:30
-
-
Save atomgomba/b21b6acf76fe3ea9df6887f33d211c22 to your computer and use it in GitHub Desktop.
Assert an 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
Baby baby = new Baby(); | |
boolean exceptionWasThrown = false; | |
try { | |
baby.removeToy(); | |
} catch (ToyNotExistsException e) { | |
exceptionWasThrown = true; | |
} | |
assertTrue(exceptionWasThrown); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment