Skip to content

Instantly share code, notes, and snippets.

@hertzsprung
Created April 7, 2012 12:39
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 hertzsprung/2328494 to your computer and use it in GitHub Desktop.
Save hertzsprung/2328494 to your computer and use it in GitHub Desktop.
Test case for Hamcrest AllOf missing mismatch description
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import org.junit.Test;
public class AllOfTest {
@Test
public void doesPrintMismatch() {
assertThat(2, greaterThan(3));
}
// I would expect "<2> was less than <3>"
@Test
public void doesNotPrintMismatch() {
assertThat(2, both(greaterThan(3)).and(lessThan(5)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment