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,依然可以正常测试。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM