mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[junit 5] add escaping for service message IDEA-330442
GitOrigin-RevId: a31d0ad69a5ed2d9626bd2b1b55d506feec0eff5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b18ef44897
commit
247bef8e18
@@ -96,9 +96,9 @@ public class JUnit5TestExecutionListener implements TestExecutionListener {
|
||||
comment = myRootName.substring(0, lastPointIdx);
|
||||
}
|
||||
|
||||
String messageName = (myPresentableName == null || myPresentableName.isEmpty()) ? escapeName(name) : myPresentableName;
|
||||
String messageName = (myPresentableName == null || myPresentableName.isEmpty()) ? name : myPresentableName;
|
||||
|
||||
myPrintStream.println("##teamcity[rootName name = '" + messageName +
|
||||
myPrintStream.println("##teamcity[rootName name = '" + escapeName(messageName) +
|
||||
(comment != null ? ("' comment = '" + escapeName(comment)) : "") + "'" +
|
||||
" location = 'java:suite://" + escapeName(myRootName) +
|
||||
"']");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.junit5;
|
||||
|
||||
import com.intellij.junit5.testData.AnnotationsTestClass;
|
||||
import com.intellij.junit5.testData.MyTestClass;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -175,4 +176,23 @@ public class JUnit5EventsTest {
|
||||
Assertions.assertInstanceOf(ClassSelector.class, selector);
|
||||
Assertions.assertEquals("com.intellij.junit5.testData.InitStaticField$MyTest", ((ClassSelector)selector).getClassName());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEscaping() throws NoSuchMethodException {
|
||||
JUnit5TestRunnerBuilder builder = new JUnit5TestRunnerBuilder();
|
||||
JUnit5TestRunnerBuilder.TestDescriptorContext testContext = builder
|
||||
.withRootName("testClass")
|
||||
.withPresentableName("testClass")
|
||||
.withTestMethod(AnnotationsTestClass.class, "test1");
|
||||
|
||||
builder.buildTestPlan().execute();
|
||||
testContext.startExecution().finish();
|
||||
|
||||
Assertions.assertEquals("""
|
||||
##teamcity[enteredTheMatrix]
|
||||
##teamcity[rootName name = 'testClass' location = 'java:suite://testClass']
|
||||
##teamcity[testStarted id='|[engine:engine|]/|[class:testClass|]/|[method:testMethod|]' name='|[test|'s method|]' nodeId='|[engine:engine|]/|[class:testClass|]/|[method:testMethod|]' parentNodeId='0' locationHint='java:test://com.intellij.junit5.testData.AnnotationsTestClass/test1' metainfo='']
|
||||
##teamcity[testFinished id='|[engine:engine|]/|[class:testClass|]/|[method:testMethod|]' name='|[test|'s method|]' nodeId='|[engine:engine|]/|[class:testClass|]/|[method:testMethod|]' parentNodeId='0']
|
||||
""", builder.getFormattedOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.junit5.testData;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings("NewClassNamingConvention")
|
||||
@DisplayName("[test's class]")
|
||||
public class AnnotationsTestClass {
|
||||
@Test
|
||||
@DisplayName("[test's method]")
|
||||
void test1() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user