Last active
March 23, 2021 14:40
-
-
Save bufferings/8e4eebcf52091eadf8fa35dcde3313d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
void testHelpfulNullPointerExceptions() { | |
NullPointerException npe = assertThrows(NullPointerException.class, () -> { | |
Object o = null; | |
o.toString(); | |
}); | |
assertEquals("Cannot invoke \"Object.toString()\" because \"o\" is null", npe.getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment