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)); 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章