diff --git a/java/execution/impl/src/com/intellij/execution/testframework/JavaAwareTestConsoleProperties.java b/java/execution/impl/src/com/intellij/execution/testframework/JavaAwareTestConsoleProperties.java index b1cf613acd5f..34a7fbf6fd04 100644 --- a/java/execution/impl/src/com/intellij/execution/testframework/JavaAwareTestConsoleProperties.java +++ b/java/execution/impl/src/com/intellij/execution/testframework/JavaAwareTestConsoleProperties.java @@ -70,7 +70,11 @@ public abstract class JavaAwareTestConsoleProperties location, @NotNull String stacktrace) { //navigate to the first stack trace - final String[] stackTrace = new LineTokenizer(stacktrace).execute(); + return getStackTraceErrorNavigatable(location, stacktrace); + } + + @Nullable + public static Navigatable getStackTraceErrorNavigatable(@NotNull Location location, @NotNull String stacktrace) { final PsiLocation psiLocation = location.toPsiLocation(); final PsiClass containingClass = psiLocation.getParentElement(PsiClass.class); if (containingClass == null) return null; @@ -83,6 +87,7 @@ public abstract class JavaAwareTestConsoleProperties location, @NotNull String stacktrace) { + return JavaAwareTestConsoleProperties.getStackTraceErrorNavigatable(location, stacktrace); + } + @NotNull private ToggleBooleanProperty createShowInternalNodesAction(TestConsoleProperties target) { String text = GradleBundle.message("gradle.test.show.internal.nodes.action.name"); diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleSMTestProxy.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleSMTestProxy.java index 3f472fc39341..08bf84decda2 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleSMTestProxy.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleSMTestProxy.java @@ -15,18 +15,11 @@ */ package org.jetbrains.plugins.gradle.execution.test.runner; -import com.intellij.execution.Location; -import com.intellij.execution.stacktrace.StackTraceLine; import com.intellij.execution.testframework.Printable; import com.intellij.execution.testframework.Printer; import com.intellij.execution.testframework.sm.runner.SMTestProxy; import com.intellij.execution.ui.ConsoleViewContentType; -import com.intellij.openapi.diff.LineTokenizer; -import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.psi.search.GlobalSearchScope; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -36,7 +29,6 @@ import org.jetbrains.annotations.Nullable; public class GradleSMTestProxy extends SMTestProxy { @Nullable private final String myClassName; - @Nullable private String myStacktrace; @Nullable private String myParentId; public GradleSMTestProxy(String testName, boolean isSuite, @Nullable String locationUrl, @Nullable String className) { @@ -53,45 +45,6 @@ public class GradleSMTestProxy extends SMTestProxy { }); } - @Override - public void setTestFailed(@NotNull String localizedMessage, @Nullable String stackTrace, boolean testError) { - setStacktraceIfNotSet(stackTrace); - super.setTestFailed(localizedMessage, stackTrace, testError); - } - - @Override - public void setTestComparisonFailed(@NotNull String localizedMessage, - @Nullable String stackTrace, - @NotNull String actualText, - @NotNull String expectedText) { - setStacktraceIfNotSet(stackTrace); - super.setTestComparisonFailed(localizedMessage, stackTrace, actualText, expectedText); - } - - @Override - public void setTestIgnored(@Nullable String ignoreComment, @Nullable String stackTrace) { - setStacktraceIfNotSet(stackTrace); - super.setTestIgnored(ignoreComment, stackTrace); - } - - @Nullable - @Override - public Location getLocation(@NotNull Project project, @NotNull GlobalSearchScope searchScope) { - if (getLocationUrl() != null) { - if (isDefect() && myStacktrace != null) { - final String[] stackTrace = new LineTokenizer(myStacktrace).execute(); - for (String aStackTrace : stackTrace) { - final StackTraceLine line = new StackTraceLine(project, aStackTrace); - if (getName().equals(line.getMethodName()) && StringUtil.equals(myClassName, line.getClassName())) { - return line.getMethodLocation(project); - } - } - } - } - - return super.getLocation(project, searchScope); - } - @Nullable public String getParentId() { return myParentId; @@ -105,8 +58,4 @@ public class GradleSMTestProxy extends SMTestProxy { public String getClassName() { return myClassName; } - - private void setStacktraceIfNotSet(@Nullable String stacktrace) { - if (myStacktrace == null) myStacktrace = stacktrace; - } }