运行Junit单测时遇到的问题

现在有两个办法解决:

   1.junit版本降到4.10

   2.导入hamcrest-core-1.3.jar

官网:JUnit now uses the latest version of Hamcrest. Thus, you can use all the available matchers and benefit from an improved assertThat which will now print the mismatch description from the matcher when an assertion fails.


junit.jar: Includes the Hamcrest classes. The simple all-in-one solution to get started quickly.Starting with version 4.11, Hamcrest is no longer included in this jar.
junit-dep.jar: Only includes the JUnit classes but not Hamcrest. Lets you use a different Hamcrest version.

意思是4.11以上版本不在包含hamcrest。

原文地址:https://www.cnblogs.com/yolanda-lee/p/10472625.html