JUnit报initializationError的解决方法

在新搭建的环境上测试时,一个模块发现错误:

java.lang.NoClassDefFoundError:org/hamcrest/SelfDescribing

一看就是缺少Class。多方查找,发现是少了hamcrest包。将hamcrest-core.jar加入到Build Path就可以了。

下载地址:http://www.java2s.com/Code/Jar/h/hamcrest.htm

junit与hamcrest关系参考http://blog.csdn.net/hanpompy/article/details/7622251

另:http://blog.csdn.net/hanpompy/article/details/7622251中的说法不确定是否完全正确。我使用的是junit-4.11.jar与hamcrest-core-1.3.jar,并没有用到hamcrest-library.jar,依然可以正常测试。

posted @ 2014-11-12 17:05  乔三  阅读(24094)  评论(1编辑  收藏  举报