关于搭配junit 和JUnit报initializationError的解决方法

关于junit是什么就不复述了,网上有

junit的source code是可以下载的,各个版本都有 地址:https://github.com/junit-team

通过junit 的source code就可以直接导出对应版本的jar包,这种办法导出的jar包是可用的,亲测

重点是junit的使用,需要依赖Hamcrest,而Hamcrest却有好多使用方式,比较凌乱。再次推荐使用-all的版本,因为标注-all的版本包含所有的jar包,省了去麻烦查找相关jar的依赖关系了,下载地址:http://hamcrest.org/JavaHamcrest/distributables or https://code.google.com/archive/p/hamcrest/downloads  or https://search.maven.org/search?q=g:org.hamcrest

一下是hamcrest 的包之间的关系说明:

我的工程里引入的hamcrest-all-1.3.jar 和 junit-4.11.jar 可以使用,之后我又自己通过source code生成了junit-4.8.2.jar,也可以使用,亲测!

希望对大家有帮助!

猜你喜欢

转载自www.cnblogs.com/ruber/p/10606665.html