diff --git a/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/CommonJavaTargetTestBase.kt b/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/CommonJavaTargetTestBase.kt index 7197ec4fedfe..4053dcd477f0 100644 --- a/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/CommonJavaTargetTestBase.kt +++ b/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/CommonJavaTargetTestBase.kt @@ -214,18 +214,12 @@ abstract class CommonJavaTargetTestBase(protected val executionMode: ExecutionMo for (child in testrun.getChildren("suite")) { child.removeAttribute("duration") for (testChild in child.getChildren("test")) { - testChild.removeAttribute("duration") - - // Stacktrace for LocalJavaTargetTest differs here due to usage of AppMainV2 in ProcessProxyFactoryImpl; - // let's mask that; AppMainV2 won't be used in production, only when running from sources - testChild.getChildren("output").forEach { - val content = it.getContent(0) - assertEquals(writer.toString(), Content.CType.Text, content.cType) - val contentText = content.value - it.setContent(Text(contentText.substring(0, contentText.length.coerceAtMost(600)))) - } + purifyTestNode(testChild, writer) } } + for (testChild in testrun.getChildren("test")) { + purifyTestNode(testChild, writer) + } val expectedText = when (executionMode) { ExecutionMode.DEBUG -> { @@ -234,12 +228,9 @@ abstract class CommonJavaTargetTestBase(protected val executionMode: ExecutionMo else -> { val element = JDOMUtil.load(expectedTestsResultExported) element.getChildren("suite").forEach { suite -> - suite.getChildren("test").forEach { testElement -> - removeContentsPartially(testElement) { - it?.text?.contains("Debugger:") ?: false - } - } + suite.getChildren("test").forEach(::removeDebuggerOutput) } + element.getChildren("test").forEach(::removeDebuggerOutput) JDOMUtil.write(element) } } @@ -248,6 +239,25 @@ abstract class CommonJavaTargetTestBase(protected val executionMode: ExecutionMo } } + private fun purifyTestNode(testNode: Element, writer: StringWriter) { + testNode.removeAttribute("duration") + + // Stacktrace for LocalJavaTargetTest differs here due to usage of AppMainV2 in ProcessProxyFactoryImpl; + // let's mask that; AppMainV2 won't be used in production, only when running from sources + testNode.getChildren("output").forEach { + val content = it.getContent(0) + assertEquals(writer.toString(), Content.CType.Text, content.cType) + val contentText = content.value + it.setContent(Text(contentText.substring(0, contentText.length.coerceAtMost(600)))) + } + } + + private fun removeDebuggerOutput(testElement: Element) { + removeContentsPartially(testElement) { + it?.text?.contains("Debugger:") ?: false + } + } + protected fun processOutputReader(demandZeroExitCode: Boolean = true, filter: (ProcessEvent, Key<*>) -> Boolean): CompletableDeferred { val textDeferred = CompletableDeferred() diff --git a/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/JavaTargetTestBase.kt b/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/JavaTargetTestBase.kt index 3f3ea49296d1..5e3398209940 100644 --- a/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/JavaTargetTestBase.kt +++ b/platform/remote-servers/target-integration-tests/testSrc/com/intellij/tests/targets/java/JavaTargetTestBase.kt @@ -210,11 +210,11 @@ abstract class JavaTargetTestBase(executionMode: ExecutionMode) : CommonJavaTarg expectedTestsResultExported = "\n" + " \n" + " \n" + - " \n" + - " \n" + - " \n" + - " Debugger: testShouldFail() reached\n" + - " org.opentest4j.AssertionFailedError: \n" + + " \n" + + " \n" + + " \n" + + " Debugger: testShouldFail() reached\n" + + " org.opentest4j.AssertionFailedError: \n" + "\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:54)\n" + "\tat org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:195)\n" + "\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:152)\n" + @@ -223,8 +223,7 @@ abstract class JavaTargetTestBase(executionMode: ExecutionMode) : CommonJavaTarg "\tat AlsoTest.testShouldFail(AlsoTest.java:12)\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(\n" + - " \n" + - " \n" + + " \n" + "") } @@ -320,11 +319,11 @@ abstract class JavaTargetTestBase(executionMode: ExecutionMode) : CommonJavaTarg expectedTestsResultExported = "\n" + " \n" + " \n" + - " \n" + - " \n" + - " \n" + - " Debugger: testShouldFail() reached\n" + - " org.opentest4j.AssertionFailedError: \n" + + " \n" + + " \n" + + " \n" + + " Debugger: testShouldFail() reached\n" + + " org.opentest4j.AssertionFailedError: \n" + "\tat org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:54)\n" + "\tat org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:195)\n" + "\tat org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:152)\n" + @@ -333,8 +332,7 @@ abstract class JavaTargetTestBase(executionMode: ExecutionMode) : CommonJavaTarg "\tat AlsoTest.testShouldFail(AlsoTest.java:12)\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + "\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(\n" + - " \n" + - " \n" + + " \n" + "") }