读书人

Maven项目使用hamcrest失误

发布时间: 2013-11-29 00:21:24 作者: rapoo

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)); 

读书人网 >行业软件

热点推荐