Maven项目使用hamcrest出错

在使用Maven项目进行测试中,
因为要引入Hamcrest的一些东西,所以需要使用如下import 代码:
import static org.hamcrest.Matchers.*

pom已经引入了 junit 4.11
但是这个引入就是报错,后来走官网才发现,还需要引入 hamcrest-library
<dependency>
	<groupId>org.hamcrest</groupId>
	<artifactId>hamcrest-library</artifactId>
	<version>${hamcrest.version}</version>
	<scope>test</scope>
</dependency>

引入后,使用就没有问题了。
assertThat( mapVar1, is(mapVar2)); 

猜你喜欢

转载自lucky16.iteye.com/blog/1977960
今日推荐