When I run my test in debugging mode in IntelliJ (2017.2 Community Edition), the source code is only available for some of the code.
In particular, when I step through code in the package com.intellij.junit4
, the debugger shows the method name and line number in the stack view, but the code doesn't appear in the editor.
You need to add the jar containing the source code to the class path of the project. The jar is located at the path plugins/junit/lib/junit-rt.jar
relative to the folder that IntelliJ is installed into.
Go to "Project Structure" > "Libraries" > "+" > "Java" and add the path of the Jar.
See also this answer.