hamcrest matching on actual empty list fails with nosuchmethoderror
adrian-herscu opened this issue · comments
Sometimes the actual asserted upon can be surprisingly different.
A list can be empty while it was expected to contain something... what a surprise...
assertThat(new ArrayList<Integer>(), equalTo(singletonList(7)));
assertThat(new ArrayList<>(), not(Matchers.empty()));
both result in java.lang.NoSuchMethodError: 'void org.hamcrest.Matcher.describeMismatch(java.lang.Object, org.hamcrest.Description)'
(hamcrest 2.1 on jdk 14)
Added a dependency having transitive dependency on Hamcrest 1.1 -- excluded and now it works as expected.