Created
November 5, 2022 03:07
-
-
Save sfboss/50f3b5ac5dd18e3c4a434293f96b7040 to your computer and use it in GitHub Desktop.
validates an exception happened
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
| public static void testValidation() { | |
| Boolean threwException = false; | |
| try { | |
| // magical test method logic here | |
| } catch (Exception e) { | |
| threwException = true; | |
| Boolean expectedExceptionThrown = (e.getMessage().contains(validationString)) ? true : false; | |
| system.AssertEquals(true, expectedExceptionThrown, e.getMessage()); | |
| } | |
| system.assertEquals(true, threwException, 'No exception was thrown'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment