Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2012 12:39
What would you like to do?
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 {
public void doesPrintMismatch() {
assertThat(2, greaterThan(3));
// I would expect "<2> was less than <3>"
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