Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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