【发布时间】:2016-01-29 08:20:09
【问题描述】:
我正在使用具有以下配置的 JUnit 4.11 和 Hamcrest 1.1 编写测试代码:
<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>
当我运行它们时,出现以下异常:
java.lang.NoClassDefFoundError: org/hamcrest/MatcherAssert
在一行包含:
assertThat(obj, hasProperty('id', 1L))
【问题讨论】:
标签: java maven exception junit hamcrest