Skip to content

Instantly share code, notes, and snippets.

@r-winkler
Created August 29, 2016 13:55
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 r-winkler/1bff8c57f7f6dcda15f26182cc0bbce2 to your computer and use it in GitHub Desktop.
Save r-winkler/1bff8c57f7f6dcda15f26182cc0bbce2 to your computer and use it in GitHub Desktop.
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void shouldThrowExpectedException(){
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("id must not be null");
throw new IllegalArgumentException("id must not be null");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment