You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by so...@apache.org on 2018/09/28 19:01:38 UTC
[maven-surefire] branch SUREFIRE-1546 updated: Rename switch to
"junit.jupiter.display.name.enabled"
This is an automated email from the ASF dual-hosted git repository.
sor pushed a commit to branch SUREFIRE-1546
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/SUREFIRE-1546 by this push:
new d73939b Rename switch to "junit.jupiter.display.name.enabled"
d73939b is described below
commit d73939b7652e52a5cfed112060944699605721a0
Author: Christian Stein <so...@gmail.com>
AuthorDate: Fri Sep 28 21:01:12 2018 +0200
Rename switch to "junit.jupiter.display.name.enabled"
The commits also adds a "failing" IT showing that UTF-8 encoded
display name are not written correctly to the "TEST-...xml" files.
Also the file names should not use the display name of the class.
---
.../apache/maven/surefire/its/JUnitPlatformIT.java | 6 +++
.../resources/junit-platform-display-names/pom.xml | 58 ++++++++++++++++++++++
.../tags/JUnitPlatformWithDisplayNameTests.java | 47 ++++++++++++++++++
.../surefire/junitplatform/RunListenerAdapter.java | 2 +-
4 files changed, 112 insertions(+), 1 deletion(-)
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java
index e1b808f..599a551 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java
@@ -45,6 +45,12 @@ public class JUnitPlatformIT
}
@Test
+ public void testDisplayNames()
+ {
+ unpack( "/junit-platform-display-names" ).executeTest().verifyErrorFree( 3 );
+ }
+
+ @Test
public void testVintageEngine()
{
unpack( "/junit-platform-engine-vintage" ).executeTest().verifyErrorFree( 1 );
diff --git a/surefire-its/src/test/resources/junit-platform-display-names/pom.xml b/surefire-its/src/test/resources/junit-platform-display-names/pom.xml
new file mode 100644
index 0000000..6f46022
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-platform-display-names/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.surefire</groupId>
+ <artifactId>junit-platform-display-names</artifactId>
+ <version>1.0</version>
+
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <junit.jupiter.display.name.enabled>true</junit.jupiter.display.name.enabled>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/surefire-its/src/test/resources/junit-platform-display-names/src/test/java/tags/JUnitPlatformWithDisplayNameTests.java b/surefire-its/src/test/resources/junit-platform-display-names/src/test/java/tags/JUnitPlatformWithDisplayNameTests.java
new file mode 100644
index 0000000..9abe661
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-platform-display-names/src/test/java/tags/JUnitPlatformWithDisplayNameTests.java
@@ -0,0 +1,47 @@
+package tags;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+@DisplayName("A special test case")
+class JUnitPlatformWithDisplayNamesTests
+{
+
+ @Test
+ @DisplayName("Custom test name containing spaces")
+ void testWithDisplayNameContainingSpaces()
+ {
+ }
+
+ @Test
+ @DisplayName("╯°□°)╯")
+ void testWithDisplayNameContainingSpecialCharacters()
+ {
+ }
+
+ @Test
+ @DisplayName("😱")
+ void testWithDisplayNameContainingEmoji()
+ {
+ }
+
+}
diff --git a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java
index 7a25434..aae5016 100644
--- a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java
+++ b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java
@@ -212,7 +212,7 @@ final class RunListenerAdapter
private String getReportingName( TestIdentifier testIdentifier )
{
- if ( Boolean.getBoolean( "surefire.junit.platform.display.name.enabled" ) )
+ if ( Boolean.getBoolean( "junit.jupiter.display.name.enabled" ) )
{
return testIdentifier.getDisplayName();
}