Hi there,
I've just faced with 2 issues.
---1. For the following example of code (assume it's a nominal case, i.e. the test should pass):
@Rule
public ExpectedException expectedException = ExpectedException.none();
...
@Test
public void test() {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Abc!");
...
}
the following exception is thrown:
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
It is caused by another NoSuchMethodError: org.hamcrest.CoreMatchers.containsString(Ljava/lang/String;)
I've checked method expectMessage, and, indeed, it has a reference to
CoreMatchers.containsString(substring)
which doesn't exist for mockito implementation of CoreMatchers.
Current versions in use by me are: junit-4.11; mockito-all-1.10.8; hamcrest-core-1.3, but I've also checked junit-4.12 & mockito-all-1.10.19, mockito-all-2.0.2-beta
Workaround for nominal test case is to use
expectedException.expectMessage(CoreMatchers.equalTo("Abc!"));---2. but! even with the 1st problem worked around, in any error case, i.e. when the test should fail, it fails with the same exception:
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
Could you investigate and fix this?