因为要引入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));