java.lang.ClassNotFoundException: junit.textui.ResultPrinter

来源:互联网 发布:马尔可夫转移矩阵例题 编辑:程序博客网 时间:2024/05/10 23:20

intelliJ Junit 测试,以上问题解决方法:


This problem happens because Android Platform (android.jar) already contains JUnit classes. IDEA test runner loads these classes and sees that they are from the old JUnit, while you are trying to use annotated tests which is a feature of the new JUnit, therefore you get the error from the test runner.

The solution is simple, open the Project Structure | Modules | Dependencies, andmove the junit-4.7.jar up, so that it comes before Android 1.6 Platform in the classpath. Now the test runner will be happy as it loads the new JUnit version.

0 0