diff --git a/java/execution/impl/src/com/intellij/execution/testframework/TestFailedLineInspection.java b/java/execution/impl/src/com/intellij/execution/testframework/TestFailedLineInspection.java index 124d4450cd18..e3b5bfa648a0 100644 --- a/java/execution/impl/src/com/intellij/execution/testframework/TestFailedLineInspection.java +++ b/java/execution/impl/src/com/intellij/execution/testframework/TestFailedLineInspection.java @@ -30,13 +30,16 @@ public class TestFailedLineInspection extends LocalInspectionTool { @Override public void visitMethodCallExpression(PsiMethodCallExpression call) { + PsiElement nameElement = call.getMethodExpression().getReferenceNameElement(); + if (nameElement == null) return; + TestStateStorage.Record state = TestFailedLineManager.getInstance(call.getProject()).getFailedLineState(call); if (state == null) return; LocalQuickFix[] fixes = {new DebugFailedTestFix(call, state.topStacktraceLine), new RunActionFix(call, DefaultRunExecutor.EXECUTOR_ID)}; ProblemDescriptor descriptor = InspectionManager.getInstance(call.getProject()) - .createProblemDescriptor(call, state.errorMessage, isOnTheFly, fixes, + .createProblemDescriptor(nameElement, state.errorMessage, isOnTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); descriptor.setTextAttributes(CodeInsightColors.RUNTIME_ERROR); holder.registerProblem(descriptor); diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/navigation/FailedLineTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/navigation/FailedLineTest.java index 77a3b037b46f..8c85a41c81ce 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/navigation/FailedLineTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/navigation/FailedLineTest.java @@ -37,7 +37,8 @@ public class FailedLineTest extends LightCodeInsightFixtureTestCase { public void testFailedLineManager() { configure(); - + myFixture.enableInspections(new TestFailedLineInspection()); + myFixture.testHighlighting(); PsiElement element = PsiUtilBase.getElementAtCaret(getEditor()); PsiMethodCallExpression callExpression = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class); PsiMethod psiMethod = PsiTreeUtil.getParentOfType(callExpression, PsiMethod.class); @@ -91,7 +92,7 @@ public class FailedLineTest extends LightCodeInsightFixtureTestCase { myFixture.addClass("package junit.framework; public class TestCase {}"); myFixture.configureByText("MainTest.java", " public class MainTest extends junit.framework.TestCase {\n" + " public void testFoo() {\n" + - " assertEquals();\n" + + " assertEquals();\n" + " assertEquals();\n" + " }\n" + " public void assertEquals() {}\n" +