i'm coding tests using junit 4.11 , hamcrest 1.1 following configuration:
<dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupid>org.hamcrest</groupid> <artifactid>hamcrest-all</artifactid> <version>1.1</version> <scope>test</scope> </dependency>
and when run them, following exception appears:
java.lang.noclassdeffounderror: org/hamcrest/matcherassert
in line containing:
assertthat(obj, hasproperty('id', 1l))
you should use hamcrest-library
instead of hamcrest-all
. hamcrest-all
not meant used dependency manager because uber-jar contains hamcrest-core
, hamcrest-library
. following snippet should work.
<dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupid>org.hamcrest</groupid> <artifactid>hamcrest-library</artifactid> <version>1.3</version> <scope>test</scope> </dependency>
Comments
Post a Comment