Skip to content

Instantly share code, notes, and snippets.

@stephan-mueller
Last active October 26, 2015 16:14
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 stephan-mueller/dd67b25adb9327316361 to your computer and use it in GitHub Desktop.
Save stephan-mueller/dd67b25adb9327316361 to your computer and use it in GitHub Desktop.
JUnit test to demonstrate hamcrest assertions.
@Test
public void hamcrestAssertion() throws Exception {
String openKnowledge = "offen, kundig, gut!";
MatcherAssert.assertThat(openKnowledge, CoreMatchers.allOf(CoreMatchers.startsWith("offen"),
CoreMatchers.containsString("kundig"),
CoreMatchers.endsWith("gut!")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment