原因 junit 4.11以上版本不再包含hamcrest jar包了,需要单独添加hamcrest-core-1.3.jar
1、在pom.xml中添加
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
2、手动导包
https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core/1.3