1. Junit-4.11 使用报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
官方文档说明:
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.1.1中没有hamcrest包了。最好的解决方法是:
使用是导入包的方案:junit.jar + hamcrest-core.jar + hamcrest-library.jar
或者是:junit-dep.ajr+hancrest-all.jar