Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. TestRunner and BaseTestRunner show a Stub error message
    JUnit
    15
    4
    2

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
java.lang.RuntimeException: Stub!
2 matching frames hidden
    at junit.textui.TestRunner.<init>(TestRunner.java:48)
    at junit.textui.TestRunner.<init>(TestRunner.java:41)

Solution

JaviRpo2 months ago

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, and move the junit-X.X.jar (or any other library where you know the TestRunner and BaseTestRunner classes are) up, so that it comes before Android 1.X Platform in the classpath. Now the test runner will be happy as it loads the new JUnit version.

External results for this pattern (10)

  1. sksamuelvia GitHub3 weeks ago
    Stub!
    Show stack trace
  2. Unknown authorvia github.com5 months ago
  3. Unknown authorvia slideshare.net5 months ago
  4. Unknown authorvia qiita.com5 months ago