下载了Java资料,发现代码中的@Test注解是红色,org.junit.Test包不存在于IDEA
解决org.junit.Test不存在问题
在Project Structure中的Libraries左侧栏中点击:+号,在IDEA目录的lib目录下找到junit-4.12.jar包,导入
再次调用注解了@Test的方法,出现异常:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
解决方法: 在Project Structure中的Libraries左侧栏中点击:+号,在IDEA目录的lib目录下找到 hamcrest-core-1.3.jar包,导入
问题解决!



