Created
May 28, 2013 20:13
-
-
Save noeticpenguin/5665729 to your computer and use it in GitHub Desktop.
apex test pattern for expecting a test.
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
boolean codeDidThrowException = false; | |
string message; | |
try { | |
code_that_will_cause_an_exception | |
} catch (System.calloutException sce) { | |
codeDidThrowException = true; | |
message = sce.getMessage(); | |
} | |
system.assert(codeDidThrowException); | |
system.assertEquals('expected string', message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment