I was shocked when something along the lines of:
assertThat(null, either(is(nullValue())).or(notNullValue()));
Fails with:
java.lang.AssertionError:
Expected: (is null or not null)
but: was null
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.junit.Assert.assertThat(Assert.java:956)
at org.junit.Assert.assertThat(Assert.java:923)
at Demo.testName(Demo.java:12)
I don't think this usage is very unusual (I am actually trying to assert null or empty map) and I couldn't find anything wrong with the Hamcrest source code...