Created
January 22, 2020 20:14
-
-
Save jbleduigou/5f22fdc21671fc35f3ae5ca3122ea1a4 to your computer and use it in GitHub Desktop.
how to assert exception with Junit 5
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
Throwable exception = assertThrows(BusinessLogicException.class, | |
() -> userService.getUserDetails(1337)); | |
assertThat(exception.getMessage(), is("Could not get user details!")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment