What is the recommended way to integrate Hamcrest into Eclipse's JUnit?
-
23-08-2019 - |
Question
Is there a recommended way to integrate Hamcrest into the JUnit configuration in Eclipse? Currently Eclipse's JUnit comes with Hamcrest-core only. I want to edit that configuration to include Hamcrest-all. How should I do this?
Solution
There's nothing to stop you adding hamcrest as a JAR to your eclipse project's build path. If there's one packaged with eclipse (and I didn't realise there was, but fair enough), then it's just there as a convenience.
OTHER TIPS
I had problems using hamcrest-all and junit-dep - you then need jMock an easymock and ant.tasks
If you just want more matchers, add hamcrest-library (along with the junit and hamcrest core you get from Eclipse)
Shouldn't this question have the "hamcrest" tag?
JUnit goes in two distributions: with Hamcrest (junit-4.6.jar) and without Hamcrest (junit-dep-4.6.jar). If I understand your question correctly, you need to specify junit-4.6.jar in JUnit configuration. I think it is possible in Eclipse (I use another IDE).