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