Skip to content

Instantly share code, notes, and snippets.

@TurhanOz
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TurhanOz/81f79b7a00a2d8c47c4e to your computer and use it in GitHub Desktop.
Save TurhanOz/81f79b7a00a2d8c47c4e to your computer and use it in GitHub Desktop.
Square/Phrase/EnhanceTests
@Test(expected = NullPointerException.class)
public void shouldThrowNullPointerException() throws Exception {
Foo foo = new Foo(null);
foo.bar(null);
}
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void loneCurlyBraceIsAMistake() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Unexpected character ' '; expected key.");
from("hi { {age}.");
}
@Test(expected = IllegalArgumentException.class)
public void loneCurlyBraceIsAMistake() {
from("hi { {age}.");
}
@Test public void loneCurlyBraceIsAMistake() {
try {
from("hi { {age}.");
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment