Junit4: Hamcrest-all 1.3 with JUnit 4.11 throws exception

Created on 9 Apr 2014  ·  4Comments  ·  Source: junit-team/junit4

Hi,

In the ExpectedException class there is this import:
import static org.hamcrest.CoreMatchers.containsString;
which cannot be resolved if you use hamcrest-all simply because the containsString method is in org.hamcrest.Matchers.

hamcrest

Most helpful comment

You should always avoid to use hamcrest-all together with JUnit because hamcrest-all contains classes of hamcrest-core. Please use hamcrest-library if you need more than the core matchers.

All 4 comments

Ah, false report. It turned out the mockito-all 1.9.5 has hamcrest integrated in which caused the problem. Sorry.

@apreg , how did you solve this issue?

sorry, I cannot remember

You should always avoid to use hamcrest-all together with JUnit because hamcrest-all contains classes of hamcrest-core. Please use hamcrest-library if you need more than the core matchers.

Was this page helpful?
0 / 5 - 0 ratings