Created
November 26, 2015 15:25
-
-
Save Rene-Frerichs/081357e294fc68aa401f to your computer and use it in GitHub Desktop.
Classic JUnit exception testing
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 tryCatch() { | |
try { | |
methodThrowsIllegalArgument(); | |
fail("Expected IllegalArgumentException!"); | |
} catch (IllegalArgumentException exception) { | |
assertThat(exception.getMessage(), is("Invalid Argument")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment