Skip to content

Instantly share code, notes, and snippets.

@noeticpenguin
Created May 28, 2013 20:13
Show Gist options
  • Save noeticpenguin/5665729 to your computer and use it in GitHub Desktop.
Save noeticpenguin/5665729 to your computer and use it in GitHub Desktop.
apex test pattern for expecting a test.
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