【JUnit 报错】 method initializationerror not found:JUnit4单元测试报错问题
用JUnit测试一段代码,出现报错method initializationerror not found;出现如下问题: 双击这个就显示出现如下的错误: method 'initializationError' not found. 解决办法: 除了引入junit-4.12.jar之外,还要引入2个依赖jar包:hamcrest-core-1.3.rc2.jar,hamcrest-library-1.3.rc2.jar 引入jar包的方法: 点击 https://mvnrepository.com/(首先你得是maven项目可以这么引用) 搜索hamcrest-core,hamcrest-library,分别粘贴对应的标签到你的pom.xml 如粘贴 <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core --> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> <version>1.3</version> <scope>test</scope> </dependency> 到pom.xml中,如下: <project xmlns="http://maven.apache.org/POM