JUnit报错method initializationerror not found的解决方法

我在一个类里先写了testCompress方法,Junit测试正常运行,然后更进一步增加了testBatchCompress()对testCompress方法进行调用,用JUnit测试报method initializationerror not found:错误:提示页面如下:



,然后查询解决问题方法,有说在导入junit.jar之后还要导入hamcrest-core-1.3.jar,hamcrest-library-1.3.jar,


根据建议导入junit.jar后,再junit运行testBatchCompress测试方法,还是报错,另看帖子说需要加方法前public,我的方法里都带有public,应该不存在此问题,最后我把testCompress方法上的@Test去掉后,测试运行成功。


猜你喜欢

转载自blog.csdn.net/nengyu/article/details/80494604