You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/04/05 22:09:23 UTC
[maven-surefire] 01/01: [SUREFIRE-1546] JUnit 5 runner does not
honor JUnit 5 display names
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch 1546-1222
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 34e5c8b3f1738eb2c7505181d02d3249ac93845a
Author: tibordigana <ti...@apache.org>
AuthorDate: Tue Apr 2 10:54:39 2019 +0200
[SUREFIRE-1546] JUnit 5 runner does not honor JUnit 5 display names
---
.../surefire/booterclient/output/ForkClient.java | 3 +-
.../booterclient/output/ForkedChannelDecoder.java | 17 +-
.../maven/plugin/surefire/report/FileReporter.java | 2 +-
.../surefire/report/StatelessXmlReporter.java | 6 +-
.../plugin/surefire/report/WrappedReportEntry.java | 32 +++-
.../booterclient/ForkingRunListenerTest.java | 4 +-
.../booterclient/output/ForkClientTest.java | 100 ++++++++++-
.../output/ForkedChannelDecoderTest.java | 55 ++++---
.../surefire/report/StatelessXmlReporterTest.java | 26 +--
.../surefire/report/WrappedReportEntryTest.java | 68 +++++++-
.../runorder/RunEntryStatisticsMapTest.java | 20 ++-
.../report/ConsoleOutputFileReporterTest.java | 8 +-
.../maven/surefire/report/FileReporterTest.java | 4 +-
pom.xml | 7 +
.../surefire/booter/ForkedChannelEncoder.java | 4 +
.../surefire/report/CategorizedReportEntry.java | 19 ++-
.../apache/maven/surefire/report/ReportEntry.java | 14 ++
.../maven/surefire/report/SimpleReportEntry.java | 129 ++++++++++-----
.../surefire/booter/ForkedChannelEncoderTest.java | 108 ++++++++----
.../apache/maven/surefire/its/JUnitPlatformIT.java | 18 +-
.../junit-platform-engine-jupiter/pom.xml | 11 ++
...{DisplayNameTest.javax => DisplayNameTest.java} | 16 +-
.../surefire/common/junit4/JUnit4RunListener.java | 10 +-
surefire-providers/surefire-junit-platform/pom.xml | 5 +
.../surefire/junitplatform/RunListenerAdapter.java | 80 ++++-----
.../junitplatform/RunListenerAdapterTest.java | 182 +++++++++++++++------
.../maven/surefire/junit/JUnit3Provider.java | 4 +-
.../apache/maven/surefire/junit/PojoTestSet.java | 12 +-
.../junit/TestListenerInvocationHandler.java | 4 +-
.../maven/surefire/junit4/JUnit4Provider.java | 4 +-
.../junitcore/NonConcurrentRunListener.java | 4 +-
.../apache/maven/surefire/junitcore/TestSet.java | 2 +-
.../maven/surefire/junitcore/TestMethodTest.java | 2 +-
.../maven/surefire/testng/TestNGReporter.java | 9 +-
.../apache/maven/surefire/testng/TestSuite.java | 4 +-
35 files changed, 691 insertions(+), 302 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index 7e7ab78..f2a934f 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -159,7 +159,8 @@ public class ForkClient
public void handle( RunMode runMode, TestSetReportEntry reportEntry )
{
testsInProgress.clear();
- TestSetReportEntry entry = reportEntry( reportEntry.getSourceName(), reportEntry.getName(),
+ TestSetReportEntry entry = reportEntry( reportEntry.getSourceName(), reportEntry.getSourceText(),
+ reportEntry.getName(), reportEntry.getNameText(),
reportEntry.getGroup(), reportEntry.getStackTraceWriter(), reportEntry.getElapsed(),
reportEntry.getMessage(), getTestVmSystemProperties() );
getTestSetReporter().testSetCompleted( entry );
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoder.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoder.java
index 60ed138..b7950d0 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoder.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoder.java
@@ -261,16 +261,18 @@ public final class ForkedChannelDecoder
if ( listener != null && encoding != null && mode != null )
{
String sourceName = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
+ String sourceText = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String name = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
+ String nameText = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String group = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String message = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String elapsed = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String traceMessage = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String smartTrimmedStackTrace = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
String stackTrace = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
-
- listener.handle( mode, toReportEntry( encoding, sourceName, name, group, message, elapsed,
- traceMessage, smartTrimmedStackTrace, stackTrace ) );
+ ReportEntry reportEntry = toReportEntry( encoding, sourceName, sourceText, name, nameText,
+ group, message, elapsed, traceMessage, smartTrimmedStackTrace, stackTrace );
+ listener.handle( mode, reportEntry );
}
}
else if ( event.isJvmExitError() )
@@ -294,7 +296,8 @@ public final class ForkedChannelDecoder
static ReportEntry toReportEntry( Charset encoding,
// ReportEntry:
- String encSource, String encName, String encGroup, String encMessage, String encTimeElapsed,
+ String encSource, String encSourceText, String encName, String encNameText,
+ String encGroup, String encMessage, String encTimeElapsed,
// StackTraceWriter:
String encTraceMessage, String encSmartTrimmedStackTrace, String encStackTrace )
throws NumberFormatException
@@ -306,14 +309,16 @@ public final class ForkedChannelDecoder
}
String source = decode( encSource, encoding );
+ String sourceText = decode( encSourceText, encoding );
String name = decode( encName, encoding );
+ String nameText = decode( encNameText, encoding );
String group = decode( encGroup, encoding );
StackTraceWriter stackTraceWriter =
decodeTrace( encoding, encTraceMessage, encSmartTrimmedStackTrace, encStackTrace );
Integer elapsed = decodeToInteger( encTimeElapsed );
String message = decode( encMessage, encoding );
- return reportEntry( source, name, group, stackTraceWriter, elapsed, message,
- Collections.<String, String>emptyMap() );
+ return reportEntry( source, sourceText, name, nameText,
+ group, stackTraceWriter, elapsed, message, Collections.<String, String>emptyMap() );
}
static String decode( String line, Charset encoding )
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
index 941b88a..9571f87 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
@@ -74,7 +74,7 @@ public class FileReporter
writer.write( "-------------------------------------------------------------------------------" );
writer.newLine();
- writer.write( "Test set: " + report.getSourceName() );
+ writer.write( "Test set: " + report.getReportSourceName() );
writer.newLine();
writer.write( "-------------------------------------------------------------------------------" );
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index 11cec8d..5052f84 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -354,14 +354,14 @@ public class StatelessXmlReporter
private void startTestElement( XMLWriter ppw, WrappedReportEntry report )
{
ppw.startElement( "testcase" );
- ppw.addAttribute( "name", report.getName() == null ? "" : extraEscape( report.getName(), true ) );
+ ppw.addAttribute( "name", report.getReportName() == null ? "" : extraEscape( report.getReportName(), true ) );
if ( report.getGroup() != null )
{
ppw.addAttribute( "group", report.getGroup() );
}
- String className = report.getReportName( reportNameSuffix );
+ String className = report.getReportSourceName( reportNameSuffix );
if ( className != null )
{
ppw.addAttribute( "classname", extraEscape( className, true ) );
@@ -378,7 +378,7 @@ public class StatelessXmlReporter
ppw.addAttribute( "xsi:noNamespaceSchemaLocation", xsdSchemaLocation );
ppw.addAttribute( "version", "3.0" );
- String reportName = report.getReportName( reportNameSuffix );
+ String reportName = report.getReportSourceName( reportNameSuffix );
ppw.addAttribute( "name", reportName == null ? "" : extraEscape( reportName, true ) );
if ( report.getGroup() != null )
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index bb4c1b1..c1912a5 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -25,6 +25,7 @@ import org.apache.maven.surefire.report.TestSetReportEntry;
import java.util.Collections;
import java.util.Map;
+import java.util.Objects;
import static java.util.Collections.unmodifiableMap;
import static org.apache.maven.plugin.surefire.report.ReporterUtils.formatElapsedTime;
@@ -103,14 +104,26 @@ public class WrappedReportEntry
}
@Override
+ public String getSourceText()
+ {
+ return original.getSourceText();
+ }
+
+ @Override
public String getName()
{
return original.getName();
}
+ @Override
+ public String getNameText()
+ {
+ return original.getNameText();
+ }
+
public String getClassMethodName()
{
- return getSourceName() + "." + getName();
+ return original.getSourceName() + "." + original.getName();
}
@Override
@@ -142,14 +155,23 @@ public class WrappedReportEntry
return formatElapsedTime( getElapsed() );
}
- public String getReportName()
+ String getReportSourceName()
+ {
+ String sourceName = getSourceName();
+ String sourceText = getSourceText();
+ return isBlank( sourceText ) || Objects.equals( sourceName, sourceText ) ? sourceName : sourceText;
+ }
+
+ String getReportSourceName( String suffix )
{
- return getSourceName();
+ return isBlank( suffix ) ? getReportSourceName() : getReportSourceName() + "(" + suffix + ")";
}
- public String getReportName( String suffix )
+ String getReportName()
{
- return isBlank( suffix ) ? getReportName() : getReportName() + "(" + suffix + ")";
+ String name = getName();
+ String nameText = getNameText();
+ return isBlank( nameText ) || Objects.equals( name, nameText ) ? name : nameText;
}
public String getOutput( boolean trimStackTrace )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
index 6b693bd..ab84690 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkingRunListenerTest.java
@@ -268,7 +268,7 @@ public class ForkingRunListenerTest
private SimpleReportEntry createDefaultReportEntry( Map<String, String> sysProps )
{
- return new SimpleReportEntry( "com.abc.TestClass", "testMethod", null, 22, sysProps );
+ return new SimpleReportEntry( "com.abc.TestClass", null, "testMethod", null, null, 22, sysProps );
}
private SimpleReportEntry createDefaultReportEntry()
@@ -278,7 +278,7 @@ public class ForkingRunListenerTest
private SimpleReportEntry createAnotherDefaultReportEntry()
{
- return new SimpleReportEntry( "com.abc.AnotherTestClass", "testAnotherMethod", 42 );
+ return new SimpleReportEntry( "com.abc.AnotherTestClass", null, "testAnotherMethod", null, 42 );
}
private SimpleReportEntry createReportEntryWithStackTrace()
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java
index e4107da..a2405c5 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClientTest.java
@@ -907,8 +907,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:testset-starting:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -939,8 +943,12 @@ public class ForkClientTest
.hasSize( 1 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getMessage() )
@@ -1017,12 +1025,16 @@ public class ForkClientTest
when( reportEntry.getGroup() ).thenReturn( "this group" );
when( reportEntry.getMessage() ).thenReturn( "some test" );
when( reportEntry.getName() ).thenReturn( "my test" );
+ when( reportEntry.getNameText() ).thenReturn( "dn2" );
when( reportEntry.getNameWithGroup() ).thenReturn( "name with group" );
when( reportEntry.getSourceName() ).thenReturn( "pkg.MyTest" );
+ when( reportEntry.getSourceText() ).thenReturn( "dn1" );
when( reportEntry.getStackTraceWriter() ).thenReturn( stackTraceWriter );
String encodedSourceName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceName() ) ) );
+ String encodedSourceText = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceText() ) ) );
String encodedName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getName() ) ) );
+ String encodedNameText = encodeBase64String( toArray( UTF_8.encode( reportEntry.getNameText() ) ) );
String encodedGroup = encodeBase64String( toArray( UTF_8.encode( reportEntry.getGroup() ) ) );
String encodedMessage = encodeBase64String( toArray( UTF_8.encode( reportEntry.getMessage() ) ) );
@@ -1030,8 +1042,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:testset-starting:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + encodedSourceText
+ + ":"
+ encodedName
+ ":"
+ + encodedNameText
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1060,8 +1076,12 @@ public class ForkClientTest
.hasSize( 1 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isEqualTo( "dn1" );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isEqualTo( "dn2" );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getMessage() )
@@ -1153,8 +1173,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:testset-completed:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1181,8 +1205,12 @@ public class ForkClientTest
.hasSize( 1 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getMessage() )
@@ -1274,8 +1302,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1307,8 +1339,12 @@ public class ForkClientTest
.hasSize( 1 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getMessage() )
@@ -1396,7 +1432,7 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
- + ":-:-:-:-:-:-:-" );
+ + ":-:-:-:-:-:-:-:-:-" );
assertThat( client.testsInProgress() )
.hasSize( 1 )
@@ -1405,8 +1441,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-succeeded:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1433,8 +1473,12 @@ public class ForkClientTest
.hasSize( 2 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isNull();
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getName() )
@@ -1530,7 +1574,7 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
- + ":-:-:-:-:-:-:-" );
+ + ":-:-:-:-:-:-:-:-:-" );
assertThat( client.testsInProgress() )
.hasSize( 1 )
@@ -1539,8 +1583,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-failed:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1567,12 +1615,20 @@ public class ForkClientTest
.hasSize( 2 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isNull();
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getMessage() )
@@ -1664,7 +1720,7 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
- + ":-:-:-:-:-:-:-" );
+ + ":-:-:-:-:-:-:-:-:-" );
assertThat( client.testsInProgress() )
.hasSize( 1 )
@@ -1673,8 +1729,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-skipped:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1701,12 +1761,20 @@ public class ForkClientTest
.hasSize( 2 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isNull();
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getNameText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getMessage() )
@@ -1787,9 +1855,11 @@ public class ForkClientTest
when( reportEntry.getName() ).thenReturn( "my test" );
when( reportEntry.getNameWithGroup() ).thenReturn( "name with group" );
when( reportEntry.getSourceName() ).thenReturn( "pkg.MyTest" );
+ when( reportEntry.getSourceText() ).thenReturn( "display name" );
when( reportEntry.getStackTraceWriter() ).thenReturn( stackTraceWriter );
String encodedSourceName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceName() ) ) );
+ String encodedSourceText = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceText() ) ) );
String encodedName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getName() ) ) );
String encodedGroup = encodeBase64String( toArray( UTF_8.encode( reportEntry.getGroup() ) ) );
String encodedMessage = encodeBase64String( toArray( UTF_8.encode( reportEntry.getMessage() ) ) );
@@ -1798,7 +1868,9 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
- + ":-:-:-:-:-:-:-" );
+ + ":"
+ + encodedSourceText
+ + ":-:':-:-:-:-:-:-" );
assertThat( client.testsInProgress() )
.hasSize( 1 )
@@ -1807,8 +1879,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-error:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + encodedSourceText
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1835,10 +1911,14 @@ public class ForkClientTest
.hasSize( 2 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isEqualTo( "display name" );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceText() )
+ .isEqualTo( "display name" );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getName() )
.isEqualTo( "my test" );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getElapsed() )
@@ -1919,12 +1999,14 @@ public class ForkClientTest
when( reportEntry.getGroup() ).thenReturn( "this group" );
when( reportEntry.getMessage() ).thenReturn( "some test" );
when( reportEntry.getName() ).thenReturn( "my test" );
+ when( reportEntry.getNameText() ).thenReturn("display name");
when( reportEntry.getNameWithGroup() ).thenReturn( "name with group" );
when( reportEntry.getSourceName() ).thenReturn( "pkg.MyTest" );
when( reportEntry.getStackTraceWriter() ).thenReturn( stackTraceWriter );
String encodedSourceName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceName() ) ) );
String encodedName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getName() ) ) );
+ String encodedText = encodeBase64String( toArray( UTF_8.encode( reportEntry.getNameText() ) ) );
String encodedGroup = encodeBase64String( toArray( UTF_8.encode( reportEntry.getGroup() ) ) );
String encodedMessage = encodeBase64String( toArray( UTF_8.encode( reportEntry.getMessage() ) ) );
@@ -1932,7 +2014,7 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
- + ":-:-:-:-:-:-:-" );
+ + ":-:-:-:-:-:-:-:-:-" );
assertThat( client.testsInProgress() )
.hasSize( 1 )
@@ -1941,8 +2023,12 @@ public class ForkClientTest
client.consumeMultiLineContent( ":maven:surefire:std:out:test-assumption-failure:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + encodedText
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -1969,12 +2055,16 @@ public class ForkClientTest
.hasSize( 2 );
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getSourceText() )
+ .isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 0 ) ).getName() )
.isNull();
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getSourceName() )
.isEqualTo( "pkg.MyTest" );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getName() )
.isEqualTo( "my test" );
+ assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getNameText() )
+ .isEqualTo( "display name" );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getElapsed() )
.isEqualTo( 102 );
assertThat( ( (ReportEntry) receiver.getData().get( 1 ) ).getMessage() )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoderTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoderTest.java
index 894ec2d..53c3562 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoderTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/output/ForkedChannelDecoderTest.java
@@ -107,22 +107,24 @@ public class ForkedChannelDecoderTest
@Test
public void shouldRecognizeEmptyStream4ReportEntry()
{
- ReportEntry reportEntry = toReportEntry( null, null, "", null, null, "",
+ ReportEntry reportEntry = toReportEntry( null, null, null, "", "", null, null, "",
"", "", null );
assertThat( reportEntry ).isNull();
- reportEntry = toReportEntry( UTF_8, "", "", "", "", "-", "", "", "" );
+ reportEntry = toReportEntry( UTF_8, "", "", "", "", "", "", "-", "", "", "" );
assertThat( reportEntry ).isNotNull();
assertThat( reportEntry.getStackTraceWriter() ).isNull();
assertThat( reportEntry.getSourceName() ).isEmpty();
+ assertThat( reportEntry.getSourceText() ).isEmpty();
assertThat( reportEntry.getName() ).isEmpty();
+ assertThat( reportEntry.getNameText() ).isEmpty();
assertThat( reportEntry.getGroup() ).isEmpty();
assertThat( reportEntry.getNameWithGroup() ).isEmpty();
assertThat( reportEntry.getMessage() ).isEmpty();
assertThat( reportEntry.getElapsed() ).isNull();
rule.expect( NumberFormatException.class );
- toReportEntry( UTF_8, "", "", "", "", "", "", "", "" );
+ toReportEntry( UTF_8, "", "", "", "", "", "", "", "", "", "" );
fail();
}
@@ -153,58 +155,66 @@ public class ForkedChannelDecoderTest
when( reportEntry.getGroup() ).thenReturn( "this group" );
when( reportEntry.getMessage() ).thenReturn( "skipped test" );
when( reportEntry.getName() ).thenReturn( "my test" );
+ when( reportEntry.getNameText() ).thenReturn( "my display name" );
when( reportEntry.getNameWithGroup() ).thenReturn( "name with group" );
when( reportEntry.getSourceName() ).thenReturn( "pkg.MyTest" );
+ when( reportEntry.getSourceText() ).thenReturn( "test class display name" );
when( reportEntry.getStackTraceWriter() ).thenReturn( stackTraceWriter );
String encodedSourceName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceName() ) ) );
+ String encodedSourceText = encodeBase64String( toArray( UTF_8.encode( reportEntry.getSourceText() ) ) );
String encodedName = encodeBase64String( toArray( UTF_8.encode( reportEntry.getName() ) ) );
+ String encodedText = encodeBase64String( toArray( UTF_8.encode( reportEntry.getNameText() ) ) );
String encodedGroup = encodeBase64String( toArray( UTF_8.encode( reportEntry.getGroup() ) ) );
String encodedMessage = encodeBase64String( toArray( UTF_8.encode( reportEntry.getMessage() ) ) );
- ReportEntry decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedName, encodedGroup,
- encodedMessage, "-", null, null, null
- );
+ ReportEntry decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedSourceText,
+ encodedName, encodedText, encodedGroup, encodedMessage, "-", null, null, null );
assertThat( decodedReportEntry ).isNotNull();
assertThat( decodedReportEntry.getSourceName() ).isEqualTo( reportEntry.getSourceName() );
+ assertThat( decodedReportEntry.getSourceText() ).isEqualTo( reportEntry.getSourceText() );
assertThat( decodedReportEntry.getName() ).isEqualTo( reportEntry.getName() );
+ assertThat( decodedReportEntry.getNameText() ).isEqualTo(reportEntry.getNameText());
assertThat( decodedReportEntry.getGroup() ).isEqualTo( reportEntry.getGroup() );
assertThat( decodedReportEntry.getMessage() ).isEqualTo( reportEntry.getMessage() );
assertThat( decodedReportEntry.getStackTraceWriter() ).isNull();
- decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedName, encodedGroup, encodedMessage,
- "-", encodedExceptionMsg, encodedSmartStackTrace, null
- );
+ decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedSourceText, encodedName, encodedText,
+ encodedGroup, encodedMessage, "-", encodedExceptionMsg, encodedSmartStackTrace, null );
assertThat( decodedReportEntry ).isNotNull();
assertThat( decodedReportEntry.getSourceName() ).isEqualTo( reportEntry.getSourceName() );
+ assertThat( decodedReportEntry.getSourceText() ).isEqualTo( reportEntry.getSourceText() );
assertThat( decodedReportEntry.getName() ).isEqualTo( reportEntry.getName() );
+ assertThat( decodedReportEntry.getNameText() ).isEqualTo(reportEntry.getNameText());
assertThat( decodedReportEntry.getGroup() ).isEqualTo( reportEntry.getGroup() );
assertThat( decodedReportEntry.getMessage() ).isEqualTo( reportEntry.getMessage() );
assertThat( decodedReportEntry.getElapsed() ).isNull();
assertThat( decodedReportEntry.getStackTraceWriter() ).isNull();
- decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedName, encodedGroup, encodedMessage,
- "1003", encodedExceptionMsg, encodedSmartStackTrace, null
- );
+ decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedSourceText, encodedName, encodedText,
+ encodedGroup, encodedMessage, "1003", encodedExceptionMsg, encodedSmartStackTrace, null );
assertThat( decodedReportEntry ).isNotNull();
assertThat( decodedReportEntry.getSourceName() ).isEqualTo( reportEntry.getSourceName() );
+ assertThat( decodedReportEntry.getSourceText() ).isEqualTo( reportEntry.getSourceText() );
assertThat( decodedReportEntry.getName() ).isEqualTo( reportEntry.getName() );
+ assertThat( decodedReportEntry.getNameText() ).isEqualTo(reportEntry.getNameText());
assertThat( decodedReportEntry.getGroup() ).isEqualTo( reportEntry.getGroup() );
assertThat( decodedReportEntry.getMessage() ).isEqualTo( reportEntry.getMessage() );
assertThat( decodedReportEntry.getElapsed() ).isEqualTo( 1003 );
assertThat( decodedReportEntry.getStackTraceWriter() ).isNull();
- decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedName, encodedGroup, encodedMessage,
- "1003", encodedExceptionMsg, encodedSmartStackTrace,
- encodedStackTrace
- );
+ decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedSourceText, encodedName, encodedText,
+ encodedGroup, encodedMessage, "1003", encodedExceptionMsg, encodedSmartStackTrace,
+ encodedStackTrace );
assertThat( decodedReportEntry ).isNotNull();
assertThat( decodedReportEntry.getSourceName() ).isEqualTo( reportEntry.getSourceName() );
+ assertThat( decodedReportEntry.getSourceText() ).isEqualTo( reportEntry.getSourceText() );
assertThat( decodedReportEntry.getName() ).isEqualTo( reportEntry.getName() );
+ assertThat( decodedReportEntry.getNameText() ).isEqualTo(reportEntry.getNameText());
assertThat( decodedReportEntry.getGroup() ).isEqualTo( reportEntry.getGroup() );
assertThat( decodedReportEntry.getMessage() ).isEqualTo( reportEntry.getMessage() );
assertThat( decodedReportEntry.getElapsed() ).isEqualTo( 1003 );
@@ -217,14 +227,15 @@ public class ForkedChannelDecoderTest
assertThat( decodedReportEntry.getStackTraceWriter().writeTraceToString() ).isEqualTo( stackTrace );
assertThat( decodedReportEntry.getStackTraceWriter().writeTrimmedTraceToString() ).isEqualTo( stackTrace );
- decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedName, encodedGroup, encodedMessage,
- "1003", encodedExceptionMsg, encodedSmartStackTrace,
- encodedTrimmedStackTrace
- );
+ decodedReportEntry = toReportEntry( UTF_8, encodedSourceName, encodedSourceText, encodedName, encodedText,
+ encodedGroup, encodedMessage, "1003", encodedExceptionMsg, encodedSmartStackTrace,
+ encodedTrimmedStackTrace );
assertThat( decodedReportEntry ).isNotNull();
assertThat( decodedReportEntry.getSourceName() ).isEqualTo( reportEntry.getSourceName() );
+ assertThat( decodedReportEntry.getSourceText() ).isEqualTo( reportEntry.getSourceText() );
assertThat( decodedReportEntry.getName() ).isEqualTo( reportEntry.getName() );
+ assertThat( decodedReportEntry.getNameText() ).isEqualTo(reportEntry.getNameText());
assertThat( decodedReportEntry.getGroup() ).isEqualTo( reportEntry.getGroup() );
assertThat( decodedReportEntry.getMessage() ).isEqualTo( reportEntry.getMessage() );
assertThat( decodedReportEntry.getElapsed() ).isEqualTo( 1003 );
@@ -643,8 +654,10 @@ public class ForkedChannelDecoderTest
when( reportEntry.getGroup() ).thenReturn( "this group" );
when( reportEntry.getMessage() ).thenReturn( reportedMessage );
when( reportEntry.getName() ).thenReturn( "my test" );
+ when( reportEntry.getName() ).thenReturn( "display name of test" );
when( reportEntry.getNameWithGroup() ).thenReturn( "name with group" );
when( reportEntry.getSourceName() ).thenReturn( "pkg.MyTest" );
+ when( reportEntry.getSourceText() ).thenReturn("test class display name");
when( reportEntry.getStackTraceWriter() ).thenReturn( stackTraceWriter );
Stream out = Stream.newStream();
@@ -777,7 +790,9 @@ public class ForkedChannelDecoderTest
public void handle( RunMode runMode, ReportEntry reportEntry )
{
assertThat( reportEntry.getSourceName() ).isEqualTo( this.reportEntry.getSourceName() );
+ assertThat( reportEntry.getSourceText() ).isEqualTo( this.reportEntry.getSourceText() );
assertThat( reportEntry.getName() ).isEqualTo( this.reportEntry.getName() );
+ assertThat( reportEntry.getNameText() ).isEqualTo( this.reportEntry.getNameText() );
assertThat( reportEntry.getGroup() ).isEqualTo( this.reportEntry.getGroup() );
assertThat( reportEntry.getMessage() ).isEqualTo( this.reportEntry.getMessage() );
assertThat( reportEntry.getElapsed() ).isEqualTo( this.reportEntry.getElapsed() );
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
index bebaed3..29b914a 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
@@ -87,7 +87,7 @@ public class StatelessXmlReporterTest
new ConcurrentHashMap<String, Deque<WrappedReportEntry>>(), XSD );
reporter.cleanTestHistoryMap();
- ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), getClass().getName(), 12 );
+ ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), null, getClass().getName(), null, 12 );
WrappedReportEntry testSetReportEntry = new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS,
12, null, null, systemProps() );
stats.testSucceeded( testSetReportEntry );
@@ -102,7 +102,7 @@ public class StatelessXmlReporterTest
public void testAllFieldsSerialized()
throws IOException
{
- ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), TEST_ONE, 12 );
+ ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), null, TEST_ONE, null, 12 );
WrappedReportEntry testSetReportEntry =
new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null, systemProps() );
expectedReportFile = new File( reportDir, "TEST-" + getClass().getName() + ".xml" );
@@ -129,8 +129,8 @@ public class StatelessXmlReporterTest
stdErr.write( stdErrPrefix + "?&-&£\u0020\u0000\u001F", false );
WrappedReportEntry t2 =
- new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), TEST_TWO, stackTraceWriter, 13 ),
- ReportEntryType.ERROR, 13, stdOut, stdErr );
+ new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), null, TEST_TWO, null,
+ stackTraceWriter, 13 ), ReportEntryType.ERROR, 13, stdOut, stdErr );
stats.testSucceeded( t2 );
StatelessXmlReporter reporter = new StatelessXmlReporter( reportDir, null, false, 0,
@@ -171,7 +171,7 @@ public class StatelessXmlReporterTest
throws IOException
{
WrappedReportEntry testSetReportEntry =
- new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), TEST_ONE, 12 ),
+ new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), null, TEST_ONE, null, 12 ),
ReportEntryType.SUCCESS, 12, null, null, systemProps() );
expectedReportFile = new File( reportDir, "TEST-" + getClass().getName() + ".xml" );
@@ -187,23 +187,23 @@ public class StatelessXmlReporterTest
String secondRunErr = "second run err";
WrappedReportEntry testTwoFirstError =
- new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), TEST_TWO, stackTraceWriterOne, 5 ),
- ReportEntryType.ERROR, 5, createStdOutput( firstRunOut ),
+ new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), null, TEST_TWO, null,
+ stackTraceWriterOne, 5 ), ReportEntryType.ERROR, 5, createStdOutput( firstRunOut ),
createStdOutput( firstRunErr ) );
WrappedReportEntry testTwoSecondError =
- new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), TEST_TWO, stackTraceWriterTwo, 13 ),
- ReportEntryType.ERROR, 13, createStdOutput( secondRunOut ),
+ new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), null, TEST_TWO, null,
+ stackTraceWriterTwo, 13 ), ReportEntryType.ERROR, 13, createStdOutput( secondRunOut ),
createStdOutput( secondRunErr ) );
WrappedReportEntry testThreeFirstRun =
- new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), TEST_THREE, stackTraceWriterOne, 13 ),
- ReportEntryType.FAILURE, 13, createStdOutput( firstRunOut ),
+ new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), null, TEST_THREE, null,
+ stackTraceWriterOne, 13 ), ReportEntryType.FAILURE, 13, createStdOutput( firstRunOut ),
createStdOutput( firstRunErr ) );
WrappedReportEntry testThreeSecondRun =
- new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), TEST_THREE, stackTraceWriterTwo, 2 ),
- ReportEntryType.SUCCESS, 2, createStdOutput( secondRunOut ),
+ new WrappedReportEntry( new SimpleReportEntry( getClass().getName(), null, TEST_THREE, null,
+ stackTraceWriterTwo, 2 ), ReportEntryType.SUCCESS, 2, createStdOutput( secondRunOut ),
createStdOutput( secondRunErr ) );
stats.testSucceeded( testTwoFirstError );
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/WrappedReportEntryTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/WrappedReportEntryTest.java
index 61080a1..014f722 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/WrappedReportEntryTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/WrappedReportEntryTest.java
@@ -23,6 +23,8 @@ import org.apache.maven.surefire.report.SimpleReportEntry;
import junit.framework.TestCase;
+import static org.apache.maven.plugin.surefire.report.ReportEntryType.*;
+
/**
* @author Kristian Rosenvold
*/
@@ -33,32 +35,80 @@ public class WrappedReportEntryTest
{
String className = "surefire.testcase.JunitParamsTest";
WrappedReportEntry wr =
- new WrappedReportEntry( new SimpleReportEntry( className, null ), null, 12, null, null );
- final String reportName = wr.getReportName();
+ new WrappedReportEntry( new SimpleReportEntry( className, null, null, null ), SUCCESS, 12, null, null );
+ final String reportName = wr.getReportSourceName();
+ assertEquals( "surefire.testcase.JunitParamsTest.null", wr.getClassMethodName() );
assertEquals( "surefire.testcase.JunitParamsTest", reportName );
+ assertTrue( wr.isSucceeded() );
+ assertFalse( wr.isErrorOrFailure() );
+ assertFalse( wr.isSkipped() );
}
public void testRegular()
{
- ReportEntry reportEntry = new SimpleReportEntry( "surefire.testcase.JunitParamsTest", "testSum" );
+ ReportEntry reportEntry = new SimpleReportEntry( "surefire.testcase.JunitParamsTest", null, "testSum", null );
WrappedReportEntry wr = new WrappedReportEntry( reportEntry, null, 12, null, null );
- final String reportName = wr.getReportName();
- assertEquals( "surefire.testcase.JunitParamsTest", reportName );
+ assertEquals( "surefire.testcase.JunitParamsTest.testSum", wr.getClassMethodName() );
+ assertEquals( "surefire.testcase.JunitParamsTest", wr.getReportSourceName() );
+ assertEquals( "surefire.testcase.JunitParamsTest(BDD)", wr.getReportSourceName( "BDD" ) );
+ assertEquals( "testSum", wr.getReportName() );
+ assertFalse(wr.isSucceeded());
+ assertFalse( wr.isErrorOrFailure() );
+ assertFalse( wr.isSkipped() );
+ assertTrue( wr.getSystemProperties().isEmpty() );
+ assertNull( wr.getGroup() );
+ assertEquals( "surefire.testcase.JunitParamsTest", wr.getNameWithGroup() );
+ }
+
+ public void testDisplayNames()
+ {
+ ReportEntry reportEntry =
+ new SimpleReportEntry( "surefire.testcase.JunitParamsTest", "dn1", "testSum", "dn2", "exception" );
+ WrappedReportEntry wr = new WrappedReportEntry( reportEntry, ERROR, 12, null, null );
+ assertEquals( "surefire.testcase.JunitParamsTest.testSum", wr.getClassMethodName() );
+ assertEquals( "dn1", wr.getReportSourceName() );
+ assertEquals( "dn1(BDD)", wr.getReportSourceName( "BDD" ) );
+ assertEquals( "dn2", wr.getReportName() );
+ assertFalse(wr.isSucceeded());
+ assertTrue(wr.isErrorOrFailure());
+ assertFalse( wr.isSkipped() );
+ assertNull( wr.getStackTraceWriter() );
+ assertEquals( "surefire.testcase.JunitParamsTest.testSum Time elapsed: 0.012 s",
+ wr.getElapsedTimeSummary() );
+ assertEquals( "surefire.testcase.JunitParamsTest.testSum Time elapsed: 0.012 s <<< ERROR!",
+ wr.getOutput( false ) );
+ assertEquals( "exception", wr.getMessage() );
+ }
+
+ public void testEqualDisplayNames()
+ {
+ ReportEntry reportEntry = new SimpleReportEntry( "surefire.testcase.JunitParamsTest",
+ "surefire.testcase.JunitParamsTest", "testSum", "testSum" );
+ WrappedReportEntry wr = new WrappedReportEntry( reportEntry, FAILURE, 12, null, null );
+ assertEquals( "surefire.testcase.JunitParamsTest", wr.getReportSourceName() );
+ assertEquals( "surefire.testcase.JunitParamsTest(BDD)", wr.getReportSourceName( "BDD" ) );
+ assertEquals( "testSum", wr.getReportName() );
+ assertFalse(wr.isSucceeded());
+ assertTrue( wr.isErrorOrFailure() );
+ assertFalse( wr.isSkipped() );
}
public void testGetReportNameWithParams()
{
String className = "[0] 1\u002C 2\u002C 3 (testSum)";
- ReportEntry reportEntry = new SimpleReportEntry( className, null );
- WrappedReportEntry wr = new WrappedReportEntry( reportEntry, null, 12, null, null );
- final String reportName = wr.getReportName();
+ ReportEntry reportEntry = new SimpleReportEntry( className, null, null, null );
+ WrappedReportEntry wr = new WrappedReportEntry( reportEntry, SKIPPED, 12, null, null );
+ final String reportName = wr.getReportSourceName();
assertEquals( "[0] 1, 2, 3 (testSum)", reportName );
+ assertFalse( wr.isSucceeded() );
+ assertFalse (wr.isErrorOrFailure() );
+ assertTrue( wr.isSkipped() );
}
public void testElapsed()
{
String className = "[0] 1\u002C 2\u002C 3 (testSum)";
- ReportEntry reportEntry = new SimpleReportEntry( className, null );
+ ReportEntry reportEntry = new SimpleReportEntry( className, null, null, null );
WrappedReportEntry wr = new WrappedReportEntry( reportEntry, null, 12, null, null );
String elapsedTimeSummary = wr.getElapsedTimeSummary();
assertEquals( "[0] 1, 2, 3 (testSum) Time elapsed: 0.012 s",
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMapTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMapTest.java
index 2970356..b38d036 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMapTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMapTest.java
@@ -81,9 +81,9 @@ public class RunEntryStatisticsMapTest
RunEntryStatisticsMap existingEntries = RunEntryStatisticsMap.fromFile( data );
RunEntryStatisticsMap newResults = new RunEntryStatisticsMap();
- ReportEntry reportEntry1 = new SimpleReportEntry( "abc", "method1", 42 );
- ReportEntry reportEntry2 = new SimpleReportEntry( "abc", "willFail", 17 );
- ReportEntry reportEntry3 = new SimpleReportEntry( "abc", "method3", 100 );
+ ReportEntry reportEntry1 = new SimpleReportEntry( "abc", null, "method1", null, 42 );
+ ReportEntry reportEntry2 = new SimpleReportEntry( "abc", null, "willFail", null, 17 );
+ ReportEntry reportEntry3 = new SimpleReportEntry( "abc", null, "method3", null, 100 );
newResults.add( existingEntries.createNextGeneration( reportEntry1 ) );
newResults.add( existingEntries.createNextGeneration( reportEntry2 ) );
@@ -104,9 +104,9 @@ public class RunEntryStatisticsMapTest
RunEntryStatisticsMap nextRun = RunEntryStatisticsMap.fromFile( data );
newResults = new RunEntryStatisticsMap();
- ReportEntry newRunReportEntry1 = new SimpleReportEntry( "abc", "method1", 52 );
- ReportEntry newRunReportEntry2 = new SimpleReportEntry( "abc", "willFail", 27 );
- ReportEntry newRunReportEntry3 = new SimpleReportEntry( "abc", "method3", 110 );
+ ReportEntry newRunReportEntry1 = new SimpleReportEntry( "abc", null, "method1", null, 52 );
+ ReportEntry newRunReportEntry2 = new SimpleReportEntry( "abc", null, "willFail", null, 27 );
+ ReportEntry newRunReportEntry3 = new SimpleReportEntry( "abc", null, "method3", null, 110 );
newResults.add( nextRun.createNextGeneration( newRunReportEntry1 ) );
newResults.add( nextRun.createNextGenerationFailure( newRunReportEntry2 ) );
@@ -129,7 +129,7 @@ public class RunEntryStatisticsMapTest
{
File data = File.createTempFile( "surefire-unit", "test" );
RunEntryStatisticsMap reportEntries = RunEntryStatisticsMap.fromFile( data );
- ReportEntry reportEntry = new SimpleReportEntry( "abc", "line1\nline2" + NL + " line3", 42 );
+ ReportEntry reportEntry = new SimpleReportEntry( "abc", null, "line1\nline2" + NL + " line3", null, 42 );
reportEntries.add( reportEntries.createNextGeneration( reportEntry ) );
reportEntries.serialize( data );
@@ -163,8 +163,10 @@ public class RunEntryStatisticsMapTest
{
File data = File.createTempFile( "surefire-unit", "test" );
RunEntryStatisticsMap reportEntries = RunEntryStatisticsMap.fromFile( data );
- reportEntries.add( reportEntries.createNextGeneration( new SimpleReportEntry( "abc", "line1\nline2", 42 ) ) );
- reportEntries.add( reportEntries.createNextGeneration( new SimpleReportEntry( "abc", "test", 10 ) ) );
+ reportEntries.add(
+ reportEntries.createNextGeneration( new SimpleReportEntry( "abc", null, "line1\nline2", null, 42 ) ) );
+ reportEntries.add(
+ reportEntries.createNextGeneration( new SimpleReportEntry( "abc", null, "test", null, 10 ) ) );
reportEntries.serialize( data );
try ( InputStream io = new FileInputStream( data ) )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
index ee086f5..9e35723 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
@@ -45,7 +45,7 @@ public class ConsoleOutputFileReporterTest
File reportDir = new File( new File( System.getProperty( "user.dir" ), "target" ), "tmp1" );
//noinspection ResultOfMethodCallIgnored
reportDir.mkdirs();
- ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), getClass().getName() );
+ ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), null, getClass().getName(), null );
ConsoleOutputFileReporter reporter = new ConsoleOutputFileReporter( reportDir, null, null );
reporter.testSetStarting( reportEntry );
reporter.writeTestOutput( "some ", false, true );
@@ -73,7 +73,7 @@ public class ConsoleOutputFileReporterTest
//noinspection ResultOfMethodCallIgnored
reportDir.mkdirs();
String suffixText = "sampleSuffixText";
- ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), getClass().getName() );
+ ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), null, getClass().getName(), null );
ConsoleOutputFileReporter reporter = new ConsoleOutputFileReporter( reportDir, suffixText, null );
reporter.testSetStarting( reportEntry );
reporter.writeTestOutput( "some ", false, true );
@@ -99,7 +99,7 @@ public class ConsoleOutputFileReporterTest
reportDir.mkdirs();
ConsoleOutputFileReporter reporter = new ConsoleOutputFileReporter( reportDir, null, null );
reporter.writeTestOutput( "some text", false, true );
- reporter.testSetCompleted( new SimpleReportEntry( getClass().getName(), getClass().getName() ) );
+ reporter.testSetCompleted( new SimpleReportEntry( getClass().getName(), null, getClass().getName(), null ) );
reporter.close();
File expectedReportFile = new File( reportDir, "null-output.txt" );
@@ -120,7 +120,7 @@ public class ConsoleOutputFileReporterTest
//noinspection ResultOfMethodCallIgnored
reportDir.mkdirs();
final ConsoleOutputFileReporter reporter = new ConsoleOutputFileReporter( reportDir, null, null );
- reporter.testSetStarting( new SimpleReportEntry( getClass().getName(), getClass().getName() ) );
+ reporter.testSetStarting( new SimpleReportEntry( getClass().getName(), null, getClass().getName(), null ) );
ExecutorService scheduler = Executors.newFixedThreadPool( 10 );
final ArrayList<Callable<Void>> jobs = new ArrayList<>();
for ( int i = 0; i < 10; i++ )
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
index b733e2a..0693626 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
@@ -42,7 +42,7 @@ public class FileReporterTest
public void testFileNameWithoutSuffix()
{
File reportDir = new File( "target" );
- reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
+ reportEntry = new SimpleReportEntry( getClass().getName(), null, testName, null );
WrappedReportEntry wrappedReportEntry =
new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null );
reporter = new FileReporter( reportDir, null, Charset.defaultCharset() );
@@ -64,7 +64,7 @@ public class FileReporterTest
{
File reportDir = new File( "target" );
String suffixText = "sampleSuffixText";
- reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
+ reportEntry = new SimpleReportEntry( getClass().getName(), null, testName, null );
WrappedReportEntry wrappedReportEntry =
new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null );
reporter = new FileReporter( reportDir, suffixText, Charset.defaultCharset() );
diff --git a/pom.xml b/pom.xml
index e30a333..740357a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -357,6 +357,12 @@
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermockVersion}</version>
</dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-reflect</artifactId>
+ <version>${powermockVersion}</version>
+ <scope>compile</scope>
+ </dependency>
<!-- END: PowerMock@Java9 -->
<dependency>
<groupId>junit</groupId>
@@ -464,6 +470,7 @@
<compilerArgs>
<arg>-Xdoclint:all</arg>
</compilerArgs>
+ <encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- NOTE: animal sniffer does not check test classes: https://jira.codehaus.org/browse/MANIMALSNIFFER-40 -->
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkedChannelEncoder.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkedChannelEncoder.java
index 9a46fca..f66e137 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkedChannelEncoder.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkedChannelEncoder.java
@@ -328,8 +328,12 @@ public final class ForkedChannelEncoder
.append( ':' )
.append( toBase64( reportEntry.getSourceName() ) )
.append( ':' )
+ .append( toBase64( reportEntry.getSourceText() ) )
+ .append( ':' )
.append( toBase64( reportEntry.getName() ) )
.append( ':' )
+ .append( toBase64( reportEntry.getNameText() ) )
+ .append( ':' )
.append( toBase64( reportEntry.getGroup() ) )
.append( ':' )
.append( toBase64( reportEntry.getMessage() ) )
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
index 226999e..b05c386 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/CategorizedReportEntry.java
@@ -42,30 +42,35 @@ public class CategorizedReportEntry
public CategorizedReportEntry( String source, String name, String group, StackTraceWriter stackTraceWriter,
Integer elapsed )
{
- super( source, name, stackTraceWriter, elapsed );
+ super( source, null, name, null, stackTraceWriter, elapsed );
this.group = group;
}
public CategorizedReportEntry( String source, String name, String group, StackTraceWriter stackTraceWriter,
Integer elapsed, String message )
{
- this( source, name, group, stackTraceWriter, elapsed, message, Collections.<String, String>emptyMap() );
+ this( source, null, name, null,
+ group, stackTraceWriter, elapsed, message, Collections.<String, String>emptyMap() );
}
- public CategorizedReportEntry( String source, String name, String group, StackTraceWriter stackTraceWriter,
+ public CategorizedReportEntry( String source, String sourceText, String name, String nameText,
+ String group, StackTraceWriter stackTraceWriter,
Integer elapsed, String message, Map<String, String> systemProperties )
{
- super( source, name, stackTraceWriter, elapsed, message, systemProperties );
+ super( source, sourceText, name, nameText, stackTraceWriter, elapsed, message, systemProperties );
this.group = group;
}
- public static TestSetReportEntry reportEntry( String source, String name, String group,
+ public static TestSetReportEntry reportEntry( String source, String sourceText, String name, String nameText,
+ String group,
StackTraceWriter stackTraceWriter, Integer elapsed, String message,
Map<String, String> systemProperties )
{
return group != null
- ? new CategorizedReportEntry( source, name, group, stackTraceWriter, elapsed, message, systemProperties )
- : new SimpleReportEntry( source, name, stackTraceWriter, elapsed, message, systemProperties );
+ ? new CategorizedReportEntry( source, sourceText, name, nameText,
+ group, stackTraceWriter, elapsed, message, systemProperties )
+ : new SimpleReportEntry( source, sourceText, name, nameText,
+ stackTraceWriter, elapsed, message, systemProperties );
}
@Override
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
index 6e4a04a..9d93b6c 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
@@ -33,6 +33,13 @@ public interface ReportEntry
String getSourceName();
/**
+ * Human readable {@link #getSourceName() test class}.
+ *
+ * @return source text
+ */
+ String getSourceText();
+
+ /**
* The name of the test case
*
* @return A string describing the test case
@@ -40,6 +47,13 @@ public interface ReportEntry
String getName();
/**
+ * Human readable {@link #getName() test case}.
+ *
+ * @return name text
+ */
+ String getNameText();
+
+ /**
* The group/category of the testcase
*
* @return A string
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
index 73e5f3b..8e8367e 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/SimpleReportEntry.java
@@ -35,79 +35,88 @@ public class SimpleReportEntry
private final String source;
+ private final String sourceText;
+
private final String name;
+ private final String nameText;
+
private final StackTraceWriter stackTraceWriter;
private final Integer elapsed;
private final String message;
- public SimpleReportEntry()
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText )
{
- this( null, null );
+ this( source, sourceText, name, nameText, null, null );
}
- public SimpleReportEntry( String source, String name )
- {
- this( source, name, null, null );
- }
-
- public SimpleReportEntry( String source, String name, Map<String, String> systemProperties )
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText,
+ Map<String, String> systemProperties )
{
- this( source, name, null, null, systemProperties );
+ this( source, sourceText, name, nameText, null, null, systemProperties );
}
- private SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter )
+ private SimpleReportEntry( String source, String sourceText, String name, String nameText,
+ StackTraceWriter stackTraceWriter )
{
- this( source, name, stackTraceWriter, null );
+ this( source, sourceText, name, nameText, stackTraceWriter, null );
}
- public SimpleReportEntry( String source, String name, Integer elapsed )
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText, Integer elapsed )
{
- this( source, name, null, elapsed );
+ this( source, sourceText, name, nameText, null, elapsed );
}
- public SimpleReportEntry( String source, String name, String message )
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText, String message )
{
- this( source, name, null, null, message, Collections.<String, String>emptyMap() );
+ this( source, sourceText, name, nameText, null, null, message, Collections.<String, String>emptyMap() );
}
- protected SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed,
- String message, Map<String, String> systemProperties )
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText,
+ StackTraceWriter stackTraceWriter, Integer elapsed, String message,
+ Map<String, String> systemProperties )
{
this.source = source;
+ this.sourceText = sourceText;
this.name = name;
+ this.nameText = nameText;
this.stackTraceWriter = stackTraceWriter;
this.message = message;
this.elapsed = elapsed;
this.systemProperties = new ImmutableMap<>( systemProperties );
}
- public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed )
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText,
+ StackTraceWriter stackTraceWriter, Integer elapsed )
{
- this( source, name, stackTraceWriter, elapsed, Collections.<String, String>emptyMap() );
+ this( source, sourceText, name, nameText, stackTraceWriter, elapsed, Collections.<String, String>emptyMap() );
}
- public SimpleReportEntry( String source, String name, StackTraceWriter stackTraceWriter, Integer elapsed,
- Map<String, String> systemProperties )
+ public SimpleReportEntry( String source, String sourceText, String name, String nameText,
+ StackTraceWriter stackTraceWriter, Integer elapsed, Map<String, String> systemProperties )
{
- this( source, name, stackTraceWriter, elapsed, safeGetMessage( stackTraceWriter ), systemProperties );
+ this( source, sourceText, name, nameText,
+ stackTraceWriter, elapsed, safeGetMessage( stackTraceWriter ), systemProperties );
}
- public static SimpleReportEntry assumption( String source, String name, String message )
+ public static SimpleReportEntry assumption( String source, String sourceText, String name, String nameText,
+ String message )
{
- return new SimpleReportEntry( source, name, message );
+ return new SimpleReportEntry( source, sourceText, name, nameText, message );
}
- public static SimpleReportEntry ignored( String source, String name, String message )
+ public static SimpleReportEntry ignored( String source, String sourceText, String name, String nameText,
+ String message )
{
- return new SimpleReportEntry( source, name, message );
+ return new SimpleReportEntry( source, sourceText, name, nameText, message );
}
- public static SimpleReportEntry withException( String source, String name, StackTraceWriter stackTraceWriter )
+ public static SimpleReportEntry withException( String source, String sourceText, String name, String nameText,
+ StackTraceWriter stackTraceWriter )
{
- return new SimpleReportEntry( source, name, stackTraceWriter );
+ return new SimpleReportEntry( source, sourceText, name, nameText, stackTraceWriter );
}
private static String safeGetMessage( StackTraceWriter stackTraceWriter )
@@ -130,12 +139,24 @@ public class SimpleReportEntry
}
@Override
+ public String getSourceText()
+ {
+ return sourceText;
+ }
+
+ @Override
public String getName()
{
return name;
}
@Override
+ public String getNameText()
+ {
+ return nameText;
+ }
+
+ @Override
public String getGroup()
{
return null;
@@ -162,8 +183,9 @@ public class SimpleReportEntry
@Override
public String toString()
{
- return "ReportEntry{" + "source='" + source + '\'' + ", name='" + name + '\'' + ", stackTraceWriter="
- + stackTraceWriter + ", elapsed=" + elapsed + ", message=" + message + '}';
+ return "ReportEntry{" + "source='" + source + "', sourceText='" + sourceText
+ + "', name='" + name + "', nameText='" + nameText + "', stackTraceWriter='"
+ + stackTraceWriter + "', elapsed='" + elapsed + "', message='" + message + "'}";
}
@Override
@@ -185,16 +207,25 @@ public class SimpleReportEntry
}
SimpleReportEntry that = (SimpleReportEntry) o;
- return isElapsedTimeEqual( that ) && isNameEqual( that ) && isSourceEqual( that ) && isStackEqual( that );
+ return isSourceEqual( that ) && isSourceTextEqual( that )
+ && isNameEqual( that ) && isNameTextEqual( that )
+ && isStackEqual( that )
+ && isElapsedTimeEqual( that )
+ && isSystemPropertiesEqual( that )
+ && isMessageEqual( that );
}
@Override
public int hashCode()
{
- int result = Objects.hashCode( source );
- result = 31 * result + Objects.hashCode( name );
- result = 31 * result + Objects.hashCode( stackTraceWriter );
- result = 31 * result + Objects.hashCode( elapsed );
+ int result = Objects.hashCode( getSourceName() );
+ result = 31 * result + Objects.hashCode( getSourceText() );
+ result = 31 * result + Objects.hashCode( getName() );
+ result = 31 * result + Objects.hashCode( getNameText() );
+ result = 31 * result + Objects.hashCode( getStackTraceWriter() );
+ result = 31 * result + Objects.hashCode( getElapsed() );
+ result = 31 * result + Objects.hashCode( getSystemProperties() );
+ result = 31 * result + Objects.hashCode( getMessage() );
return result;
}
@@ -212,21 +243,41 @@ public class SimpleReportEntry
private boolean isElapsedTimeEqual( SimpleReportEntry en )
{
- return Objects.equals( elapsed, en.elapsed );
+ return Objects.equals( getElapsed(), en.getElapsed() );
+ }
+
+ private boolean isNameTextEqual( SimpleReportEntry en )
+ {
+ return Objects.equals( getNameText(), en.getNameText() );
}
private boolean isNameEqual( SimpleReportEntry en )
{
- return Objects.equals( name, en.name );
+ return Objects.equals( getName(), en.getName() );
}
private boolean isSourceEqual( SimpleReportEntry en )
{
- return Objects.equals( source, en.source );
+ return Objects.equals( getSourceName(), en.getSourceName() );
+ }
+
+ private boolean isSourceTextEqual( SimpleReportEntry en )
+ {
+ return Objects.equals( getSourceText(), en.getSourceText() );
}
private boolean isStackEqual( SimpleReportEntry en )
{
- return Objects.equals( stackTraceWriter, en.stackTraceWriter );
+ return Objects.equals( getStackTraceWriter(), en.getStackTraceWriter() );
+ }
+
+ private boolean isSystemPropertiesEqual( SimpleReportEntry en )
+ {
+ return Objects.equals( getSystemProperties(), en.getSystemProperties() );
+ }
+
+ private boolean isMessageEqual( SimpleReportEntry en )
+ {
+ return Objects.equals( getMessage(), en.getMessage() );
}
}
diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/booter/ForkedChannelEncoderTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/booter/ForkedChannelEncoderTest.java
index b9708b0..4429f79 100644
--- a/surefire-api/src/test/java/org/apache/maven/surefire/booter/ForkedChannelEncoderTest.java
+++ b/surefire-api/src/test/java/org/apache/maven/surefire/booter/ForkedChannelEncoderTest.java
@@ -179,43 +179,51 @@ public class ForkedChannelEncoderTest
StringBuilder encode = encode( "X", "normal-run", reportEntry, false );
assertThat( encode.toString() )
.isEqualTo( ":maven:surefire:std:out:X:normal-run:UTF-8:"
- + encodedSourceName
- + ":"
- + encodedName
- + ":"
- + encodedGroup
- + ":"
- + encodedMessage
- + ":"
- + 102
- + ":"
-
- + encodedExceptionMsg
- + ":"
- + encodedSmartStackTrace
- + ":"
- + encodedStackTrace
+ + encodedSourceName
+ + ":"
+ + "-"
+ + ":"
+ + encodedName
+ + ":"
+ + "-"
+ + ":"
+ + encodedGroup
+ + ":"
+ + encodedMessage
+ + ":"
+ + 102
+ + ":"
+
+ + encodedExceptionMsg
+ + ":"
+ + encodedSmartStackTrace
+ + ":"
+ + encodedStackTrace
);
encode = encode( "X", "normal-run", reportEntry, true );
assertThat( encode.toString() )
.isEqualTo( ":maven:surefire:std:out:X:normal-run:UTF-8:"
- + encodedSourceName
- + ":"
- + encodedName
- + ":"
- + encodedGroup
- + ":"
- + encodedMessage
- + ":"
- + 102
- + ":"
-
- + encodedExceptionMsg
- + ":"
- + encodedSmartStackTrace
- + ":"
- + encodedTrimmedStackTrace
+ + encodedSourceName
+ + ":"
+ + "-"
+ + ":"
+ + encodedName
+ + ":"
+ + "-"
+ + ":"
+ + encodedGroup
+ + ":"
+ + encodedMessage
+ + ":"
+ + 102
+ + ":"
+
+ + encodedExceptionMsg
+ + ":"
+ + encodedSmartStackTrace
+ + ":"
+ + encodedTrimmedStackTrace
);
Stream out = Stream.newStream();
@@ -227,8 +235,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:testset-starting:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -253,8 +265,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:testset-starting:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -316,8 +332,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:testset-completed:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -379,8 +399,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:test-starting:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -442,8 +466,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:test-succeeded:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -505,8 +533,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:test-failed:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -567,8 +599,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:test-skipped:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -628,8 +664,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:test-error:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
@@ -687,8 +727,12 @@ public class ForkedChannelEncoderTest
.isEqualTo( ":maven:surefire:std:out:test-assumption-failure:normal-run:UTF-8:"
+ encodedSourceName
+ ":"
+ + "-"
+ + ":"
+ encodedName
+ ":"
+ + "-"
+ + ":"
+ encodedGroup
+ ":"
+ encodedMessage
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 7675843..73f3748 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
@@ -22,10 +22,11 @@ package org.apache.maven.surefire.its;
import org.apache.maven.surefire.its.fixture.OutputValidator;
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
+import static org.apache.maven.surefire.its.fixture.HelperAssertions.convertUnicodeToUTF8;
public class JUnitPlatformIT
extends SurefireJUnit4IntegrationTestCase
@@ -40,27 +41,24 @@ public class JUnitPlatformIT
public void testJupiterEngine()
{
unpack( "/junit-platform-engine-jupiter" )
+ .setTestToRun( "Basic*Test" )
.executeTest()
.verifyErrorFree( 5 );
}
@Test
- @Ignore( "Uncomment while developing SUREFIRE-1222. Rename 'javax' extension of DisplayNameTest.javax." )
public void testJupiterEngineWithDisplayNames()
{
OutputValidator validator = unpack( "/junit-platform-engine-jupiter" )
.executeTest()
.verifyErrorFree( 7 );
- validator.getSurefireReportsFile( "junitplatformenginejupiter.DisplayNameTest.txt" )
- // .assertContainsText( "<< ✨ >>" ) // after @DisplayName is uncommented via SUREFIRE-1222
- .assertContainsText( "Test set: junitplatformenginejupiter.DisplayNameTest" );
+ validator.getSurefireReportsFile( "junitplatformenginejupiter.DisplayNameTest.txt", UTF_8 )
+ .assertContainsText( convertUnicodeToUTF8( "<< ✨ >>" ) );
- validator.getSurefireReportsFile( "TEST-junitplatformenginejupiter.DisplayNameTest.xml" )
- // At the moment, the testcase with the same is reported twice: test1() and test2() use the same display name
- // SUREFIRE-1222 will solve this.
- .assertContainsText( "testcase name=\"73$71 ✔\" classname=\"junitplatformenginejupiter.DisplayNameTest\"" )
- .assertContainsText( "testcase name=\"73$71 ✔\" classname=\"junitplatformenginejupiter.DisplayNameTest\"" );
+ validator.getSurefireReportsFile( "TEST-junitplatformenginejupiter.DisplayNameTest.xml", UTF_8 )
+ .assertContainsText( "testcase name=\"73$71 ✔\" classname=\"<< ✨ >>\"" )
+ .assertContainsText( "testcase name=\"73$72 ✔\" classname=\"<< ✨ >>\"" );
}
@Test
diff --git a/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml b/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
index 192cc8a..bbcc715 100644
--- a/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
@@ -32,6 +32,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.jupiter.version>5.2.0</junit.jupiter.version>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<!--
@@ -58,9 +59,19 @@
<build>
<plugins>
<plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.7.0</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.javax b/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.java
similarity index 65%
rename from surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.javax
rename to surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.java
index 8089ad0..a6401e3 100644
--- a/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.javax
+++ b/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.java
@@ -19,25 +19,27 @@ package junitplatformenginejupiter;
* under the License.
*/
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
-// TODO Uncomment after SUREFIRE-1222 is done
-// @DisplayName("<< ✨ >>")
+@DisplayName( "<< ✨ >>" )
class DisplayNameTest
{
@Test
- @DisplayName("73$71 ✔")
+ @DisplayName( "73$71 ✔" )
void test1()
+ throws Exception
{
+ System.out.println( getClass().getDeclaredMethod( "test1" ).getAnnotation( DisplayName.class ).value() );
+ System.out.println( getClass().getAnnotation( DisplayName.class ).value() );
}
@Test
- @DisplayName("73$71 ✔")
+ @DisplayName( "73$72 ✔" )
void test2()
+ throws Exception
{
+ System.out.println( getClass().getDeclaredMethod( "test2" ).getAnnotation( DisplayName.class ).value() );
+ System.out.println( getClass().getAnnotation( DisplayName.class ).value() );
}
}
diff --git a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
index 234bcf5..c4a7991 100644
--- a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
+++ b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
@@ -76,7 +76,7 @@ public class JUnit4RunListener
{
String reason = getAnnotatedIgnoreValue( description );
ClassMethod classMethod = toClassMethod( description );
- reporter.testSkipped( ignored( classMethod.getClazz(), classMethod.getMethod(), reason ) );
+ reporter.testSkipped( ignored( classMethod.getClazz(), null, classMethod.getMethod(), null, reason ) );
}
/**
@@ -112,7 +112,8 @@ public class JUnit4RunListener
{
StackTraceWriter stackTrace = createStackTraceWriter( failure );
ClassMethod classMethod = toClassMethod( failure.getDescription() );
- ReportEntry report = withException( classMethod.getClazz(), classMethod.getMethod(), stackTrace );
+ ReportEntry report =
+ withException( classMethod.getClazz(), null, classMethod.getMethod(), null, stackTrace );
if ( failure.getException() instanceof AssertionError )
{
@@ -135,7 +136,8 @@ public class JUnit4RunListener
{
Description desc = failure.getDescription();
ClassMethod classMethod = toClassMethod( desc );
- ReportEntry report = assumption( classMethod.getClazz(), classMethod.getMethod(), failure.getMessage() );
+ ReportEntry report = assumption( classMethod.getClazz(), null, classMethod.getMethod(), null,
+ failure.getMessage() );
reporter.testAssumptionFailure( report );
}
finally
@@ -176,7 +178,7 @@ public class JUnit4RunListener
protected SimpleReportEntry createReportEntry( Description description )
{
ClassMethod classMethod = toClassMethod( description );
- return new SimpleReportEntry( classMethod.getClazz(), classMethod.getMethod() );
+ return new SimpleReportEntry( classMethod.getClazz(), null, classMethod.getMethod(), null );
}
public static void rethrowAnyTestMechanismFailures( Result run )
diff --git a/surefire-providers/surefire-junit-platform/pom.xml b/surefire-providers/surefire-junit-platform/pom.xml
index 8533b56..eaaaeef 100644
--- a/surefire-providers/surefire-junit-platform/pom.xml
+++ b/surefire-providers/surefire-junit-platform/pom.xml
@@ -101,6 +101,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-reflect</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
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 0f9f8bb..29f3eeb 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
@@ -23,6 +23,7 @@ import static java.util.Collections.emptyMap;
import static org.apache.maven.surefire.util.internal.ObjectUtils.systemProps;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@@ -74,12 +75,12 @@ final class RunListenerAdapter
&& testIdentifier.getSource().filter( ClassSource.class::isInstance ).isPresent() )
{
testStartTime.put( testIdentifier, System.currentTimeMillis() );
- runListener.testSetStarting( createTestSetReportEntry( testIdentifier ) );
+ runListener.testSetStarting( createReportEntry( testIdentifier ) );
}
else if ( testIdentifier.isTest() )
{
testStartTime.put( testIdentifier, System.currentTimeMillis() );
- runListener.testStarting( createTestSetReportEntry( testIdentifier ) );
+ runListener.testStarting( createReportEntry( testIdentifier ) );
}
}
@@ -104,15 +105,15 @@ final class RunListenerAdapter
}
else
{
- runListener.testSetCompleted( createTestSetReportEntry( testIdentifier, testExecutionResult,
- systemProps(), elapsed ) );
+ runListener.testSetCompleted( createReportEntry( testIdentifier, testExecutionResult,
+ systemProps(), null, elapsed ) );
}
break;
case FAILED:
if ( !isTest )
{
- runListener.testSetCompleted( createTestSetReportEntry( testIdentifier, testExecutionResult,
- systemProps(), elapsed ) );
+ runListener.testSetCompleted( createReportEntry( testIdentifier, testExecutionResult,
+ systemProps(), null, elapsed ) );
}
else if ( testExecutionResult.getThrowable()
.filter( AssertionError.class::isInstance ).isPresent() )
@@ -127,12 +128,12 @@ final class RunListenerAdapter
default:
if ( isTest )
{
- runListener.testSucceeded( createReportEntry( testIdentifier, elapsed ) );
+ runListener.testSucceeded( createReportEntry( testIdentifier, null, elapsed ) );
}
else
{
runListener.testSetCompleted(
- createTestSetReportEntry( testIdentifier, null, systemProps(), elapsed ) );
+ createReportEntry( testIdentifier, null, systemProps(), null, elapsed ) );
}
}
}
@@ -149,58 +150,43 @@ final class RunListenerAdapter
public void executionSkipped( TestIdentifier testIdentifier, String reason )
{
testStartTime.remove( testIdentifier );
- String[] classMethodName = toClassMethodName( testIdentifier );
- String className = classMethodName[1];
- String methodName = classMethodName[3];
- runListener.testSkipped( new SimpleReportEntry( className, methodName, reason ) );
+ runListener.testSkipped( createReportEntry( testIdentifier, null, emptyMap(), reason, null ) );
}
- private SimpleReportEntry createTestSetReportEntry( TestIdentifier testIdentifier,
- TestExecutionResult testExecutionResult,
- Map<String, String> systemProperties,
- Integer elapsedTime )
+ private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier,
+ TestExecutionResult testExecutionResult,
+ Map<String, String> systemProperties,
+ String reason,
+ Integer elapsedTime )
{
String[] classMethodName = toClassMethodName( testIdentifier );
- String className = classMethodName[1];
- String methodName = classMethodName[3];
+ String className = classMethodName[0];
+ String classText = classMethodName[1];
+ if ( Objects.equals( className, classText ) )
+ {
+ classText = null;
+ }
+ String methodName = testIdentifier.isTest() ? classMethodName[2] : null;
+ String methodText = testIdentifier.isTest() ? classMethodName[3] : null;
+ if ( Objects.equals( methodName, methodText ) )
+ {
+ methodText = null;
+ }
StackTraceWriter stw =
testExecutionResult == null ? null : toStackTraceWriter( className, methodName, testExecutionResult );
- return new SimpleReportEntry( className, methodName, stw, elapsedTime, systemProperties );
+ return new SimpleReportEntry( className, classText, methodName, methodText,
+ stw, elapsedTime, reason, systemProperties );
}
- private SimpleReportEntry createTestSetReportEntry( TestIdentifier testIdentifier )
+ private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier )
{
- return createTestSetReportEntry( testIdentifier, emptyMap() );
- }
-
- private SimpleReportEntry createTestSetReportEntry( TestIdentifier testIdentifier,
- Map<String, String> systemProperties )
- {
- return createTestSetReportEntry( testIdentifier, null, systemProperties, null );
- }
-
- private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier, Integer elapsedTime )
- {
- return createReportEntry( testIdentifier, (StackTraceWriter) null, elapsedTime );
+ return createReportEntry( testIdentifier, null, null );
}
private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier,
TestExecutionResult testExecutionResult, Integer elapsedTime )
{
- String[] classMethodNames = toClassMethodName( testIdentifier );
- String realClassName = classMethodNames[0];
- String realMethodName = classMethodNames[2];
- return createReportEntry( testIdentifier,
- toStackTraceWriter( realClassName, realMethodName, testExecutionResult ), elapsedTime );
- }
-
- private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier, StackTraceWriter stackTraceWriter,
- Integer elapsedTime )
- {
- String[] classMethodNames = toClassMethodName( testIdentifier );
- String className = classMethodNames[1];
- String methodName = classMethodNames[3];
- return new SimpleReportEntry( className, methodName, stackTraceWriter, elapsedTime );
+ return createReportEntry( testIdentifier, testExecutionResult, emptyMap(), null, elapsedTime );
}
private StackTraceWriter toStackTraceWriter( String realClassName, String realMethodName,
@@ -263,7 +249,7 @@ final class RunListenerAdapter
String className = classSource.getClassName();
String simpleClassName = className.substring( 1 + className.lastIndexOf( '.' ) );
String source = display.equals( simpleClassName ) ? className : display;
- return new String[] { source, source, null, null };
+ return new String[] { className, source, null, null };
}
else
{
diff --git a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
index bbc4457..e9c53ba 100644
--- a/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
+++ b/surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java
@@ -33,8 +33,10 @@ import static org.junit.platform.engine.TestExecutionResult.failed;
import static org.junit.platform.engine.TestExecutionResult.successful;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
+import static org.powermock.reflect.Whitebox.getInternalState;
import java.lang.reflect.Method;
+import java.util.Map;
import java.util.Optional;
import org.apache.maven.surefire.report.PojoStackTraceWriter;
@@ -50,7 +52,6 @@ import org.junit.jupiter.engine.descriptor.ClassTestDescriptor;
import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor;
import org.junit.platform.engine.ConfigurationParameters;
import org.junit.platform.engine.TestDescriptor;
-import org.junit.platform.engine.TestDescriptor.Type;
import org.junit.platform.engine.TestSource;
import org.junit.platform.engine.UniqueId;
import org.junit.platform.engine.support.descriptor.AbstractTestDescriptor;
@@ -121,8 +122,10 @@ public class RunListenerAdapterTest
verify( listener ).testStarting( entryCaptor.capture() );
ReportEntry entry = entryCaptor.getValue();
- assertEquals( MY_TEST_METHOD_NAME + "(String)", entry.getName() );
+ assertEquals( MY_TEST_METHOD_NAME, entry.getName() );
+ assertEquals( MY_TEST_METHOD_NAME + "(String)", entry.getNameText() );
assertEquals( MyTestClass.class.getName(), entry.getSourceName() );
+ assertNull( entry.getSourceText() );
assertNull( entry.getStackTraceWriter() );
}
@@ -137,23 +140,31 @@ public class RunListenerAdapterTest
parent.addChild( child );
TestPlan plan = TestPlan.from( singletonList( engine ) );
+ String className = MyTestClass.class.getName();
+
adapter.testPlanExecutionStarted( plan );
adapter.executionStarted( TestIdentifier.from( engine ) );
adapter.executionStarted( TestIdentifier.from( parent ) );
- verify( listener ).testSetStarting( new SimpleReportEntry( MyTestClass.class.getName(), null ) );
+ verify( listener )
+ .testSetStarting( new SimpleReportEntry( className, null, null, null ) );
verifyNoMoreInteractions( listener );
adapter.executionStarted( TestIdentifier.from( child ) );
- verify( listener ).testStarting( new SimpleReportEntry( MyTestClass.class.getName(), MY_TEST_METHOD_NAME ) );
+ verify( listener )
+ .testStarting( new SimpleReportEntry( className, null, MY_TEST_METHOD_NAME, null ) );
verifyNoMoreInteractions( listener );
adapter.executionFinished( TestIdentifier.from( child ), successful() );
ArgumentCaptor<SimpleReportEntry> report = ArgumentCaptor.forClass( SimpleReportEntry.class );
verify( listener ).testSucceeded( report.capture() );
assertThat( report.getValue().getSourceName() )
- .isEqualTo( MyTestClass.class.getName() );
+ .isEqualTo( className );
+ assertThat( report.getValue().getSourceText() )
+ .isNull();
assertThat( report.getValue().getName() )
.isEqualTo( MY_TEST_METHOD_NAME );
+ assertThat( report.getValue().getNameText() )
+ .isNull();
assertThat( report.getValue().getElapsed() )
.isNotNull();
assertThat( report.getValue().getSystemProperties() )
@@ -164,7 +175,7 @@ public class RunListenerAdapterTest
report = ArgumentCaptor.forClass( SimpleReportEntry.class );
verify( listener ).testSetCompleted( report.capture() );
assertThat( report.getValue().getSourceName() )
- .isEqualTo( MyTestClass.class.getName() );
+ .isEqualTo( className );
assertThat( report.getValue().getName() )
.isNull();
assertThat( report.getValue().getElapsed() )
@@ -179,14 +190,22 @@ public class RunListenerAdapterTest
@Test
public void displayNamesInClassAndMethods()
+ throws Exception
{
EngineDescriptor engine = newEngineDescriptor();
TestDescriptor parent = newClassDescriptor( "parent" );
engine.addChild( parent );
- TestDescriptor child1 = newTestDescriptor( parent.getUniqueId().append( "test", "child1" ), "child1", TEST );
+
+ UniqueId id1 = parent.getUniqueId().append( MyTestClass.class.getName(), MY_NAMED_TEST_METHOD_NAME );
+ Method m1 = MyTestClass.class.getDeclaredMethod( MY_NAMED_TEST_METHOD_NAME );
+ TestDescriptor child1 = new TestMethodTestDescriptorWithDisplayName( id1, MyTestClass.class, m1, "dn1" );
parent.addChild( child1 );
- TestDescriptor child2 = newTestDescriptor( parent.getUniqueId().append( "test", "child2" ), "child2", TEST );
+
+ UniqueId id2 = parent.getUniqueId().append( MyTestClass.class.getName(), MY_TEST_METHOD_NAME );
+ Method m2 = MyTestClass.class.getDeclaredMethod( MY_TEST_METHOD_NAME, String.class );
+ TestDescriptor child2 = new TestMethodTestDescriptor( id2, MyTestClass.class, m2 );
parent.addChild( child2 );
+
TestPlan plan = TestPlan.from( singletonList( engine ) );
InOrder inOrder = inOrder( listener );
@@ -198,6 +217,8 @@ public class RunListenerAdapterTest
ArgumentCaptor<SimpleReportEntry> report = ArgumentCaptor.forClass( SimpleReportEntry.class );
inOrder.verify( listener ).testSetStarting( report.capture() );
assertThat( report.getValue().getSourceName() )
+ .isEqualTo( MyTestClass.class.getName() );
+ assertThat( report.getValue().getSourceText() )
.isEqualTo( "parent" );
assertThat( report.getValue().getName() )
.isNull();
@@ -206,53 +227,76 @@ public class RunListenerAdapterTest
verifyZeroInteractions( listener );
adapter.executionStarted( TestIdentifier.from( child1 ) );
- inOrder.verify( listener ).testStarting( new SimpleReportEntry( "parent", "child1" ) );
- verifyNoMoreInteractions( listener );
+ inOrder.verify( listener )
+ .testStarting( new SimpleReportEntry( MyTestClass.class.getName(), "parent",
+ MY_NAMED_TEST_METHOD_NAME, "dn1" ) );
+ inOrder.verifyNoMoreInteractions();
adapter.executionFinished( TestIdentifier.from( child1 ), successful() );
report = ArgumentCaptor.forClass( SimpleReportEntry.class );
inOrder.verify( listener ).testSucceeded( report.capture() );
assertThat( report.getValue().getSourceName() )
+ .isEqualTo( MyTestClass.class.getName() );
+ assertThat( report.getValue().getSourceText() )
.isEqualTo( "parent" );
assertThat( report.getValue().getName() )
- .isEqualTo( "child1" );
+ .isEqualTo( MY_NAMED_TEST_METHOD_NAME );
+ assertThat( report.getValue().getNameText() )
+ .isEqualTo( "dn1" );
assertThat( report.getValue().getElapsed() )
.isNotNull();
assertThat( report.getValue().getSystemProperties() )
.isEmpty();
- verifyNoMoreInteractions( listener );
+ inOrder.verifyNoMoreInteractions();
adapter.executionStarted( TestIdentifier.from( child2 ) );
- inOrder.verify( listener ).testStarting( new SimpleReportEntry( "parent", "child2" ) );
- verifyNoMoreInteractions( listener );
+ inOrder.verify( listener )
+ .testStarting( new SimpleReportEntry( MyTestClass.class.getName(), "parent",
+ MY_TEST_METHOD_NAME, MY_TEST_METHOD_NAME + "(String)" ) );
+ inOrder.verifyNoMoreInteractions();
- adapter.executionFinished( TestIdentifier.from( child2 ), successful() );
+ Exception assumptionFailure = new Exception();
+ adapter.executionFinished( TestIdentifier.from( child2 ), aborted( assumptionFailure ) );
report = ArgumentCaptor.forClass( SimpleReportEntry.class );
- inOrder.verify( listener ).testSucceeded( report.capture() );
+ inOrder.verify( listener ).testAssumptionFailure( report.capture() );
assertThat( report.getValue().getSourceName() )
+ .isEqualTo( MyTestClass.class.getName() );
+ assertThat( report.getValue().getSourceText() )
.isEqualTo( "parent" );
assertThat( report.getValue().getName() )
- .isEqualTo( "child2" );
+ .isEqualTo( MY_TEST_METHOD_NAME );
+ assertThat( report.getValue().getNameText() )
+ .isEqualTo( MY_TEST_METHOD_NAME + "(String)" );
assertThat( report.getValue().getElapsed() )
.isNotNull();
assertThat( report.getValue().getSystemProperties() )
.isEmpty();
- verifyNoMoreInteractions( listener );
+ assertThat( report.getValue().getStackTraceWriter() )
+ .isNotNull();
+ assertThat( report.getValue().getStackTraceWriter().getThrowable().getTarget() )
+ .isSameAs(assumptionFailure);
+ inOrder.verifyNoMoreInteractions();
adapter.executionFinished( TestIdentifier.from( parent ), successful() );
inOrder.verify( listener ).testSetCompleted( report.capture() );
assertThat( report.getValue().getSourceName() )
+ .isEqualTo( MyTestClass.class.getName() );
+ assertThat( report.getValue().getSourceText() )
.isEqualTo( "parent" );
assertThat( report.getValue().getName() )
.isNull();
+ assertThat( report.getValue().getNameText() )
+ .isNull();
assertThat( report.getValue().getElapsed() )
.isNotNull();
assertThat( report.getValue().getSystemProperties() )
.isNotEmpty();
- verifyNoMoreInteractions( listener );
+ assertThat( report.getValue().getStackTraceWriter() )
+ .isNull();
+ inOrder.verifyNoMoreInteractions();
adapter.executionFinished( TestIdentifier.from( engine ), successful() );
- verifyNoMoreInteractions( listener );
+ inOrder.verifyNoMoreInteractions();
}
@Test
@@ -269,8 +313,15 @@ public class RunListenerAdapterTest
TestPlan plan = TestPlan.from( singletonList( engine ) );
adapter.testPlanExecutionStarted( plan );
+ assertThat( (TestPlan) getInternalState( adapter, "testPlan" ) )
+ .isSameAs( plan );
+ assertThat( (Map) getInternalState( adapter, "testStartTime" ) )
+ .isEmpty();
+
+
adapter.executionStarted( TestIdentifier.from( engine ) );
- verify( listener ).testStarting( new SimpleReportEntry( "engine", "engine" ) );
+ verify( listener )
+ .testStarting( new SimpleReportEntry( "engine", null, "engine", null ) );
verifyNoMoreInteractions( listener );
adapter.executionFinished( TestIdentifier.from( engine ), successful() );
@@ -278,12 +329,25 @@ public class RunListenerAdapterTest
verify( listener ).testSucceeded( report.capture() );
assertThat( report.getValue().getSourceName() )
.isEqualTo( "engine" );
+ assertThat( report.getValue().getSourceText() )
+ .isNull();
assertThat( report.getValue().getName() )
.isEqualTo( "engine" );
- assertThat( report.getValue().getElapsed() )
+ assertThat( report.getValue().getNameText() )
+ .isNull();
+ assertThat(report.getValue().getElapsed())
.isNotNull();
+ assertThat( report.getValue().getStackTraceWriter() )
+ .isNull();
assertThat( report.getValue().getSystemProperties() )
.isEmpty();
+
+ adapter.testPlanExecutionFinished( plan );
+ assertThat( (TestPlan) getInternalState( adapter, "testPlan" ) )
+ .isNull();
+ assertThat( (Map) getInternalState( adapter, "testStartTime" ) )
+ .isEmpty();
+
verifyNoMoreInteractions( listener );
}
@@ -405,20 +469,34 @@ public class RunListenerAdapterTest
adapter.executionFinished( TestIdentifier.from( classDescriptor ), successful() );
- verify( listener ).testSetStarting( new SimpleReportEntry( MyTestClass.class.getName(), null ) );
+ String className = MyTestClass.class.getName();
+
+ verify( listener )
+ .testSetStarting( new SimpleReportEntry( className, null, null, null ) );
ArgumentCaptor<SimpleReportEntry> report = ArgumentCaptor.forClass( SimpleReportEntry.class );
- verify( listener ).testSetCompleted( report.capture() );
+ verify( listener )
+ .testSetCompleted(report.capture() );
+
assertThat( report.getValue().getSourceName() )
- .isEqualTo( MyTestClass.class.getName() );
+ .isEqualTo( className );
+ assertThat( report.getValue().getSourceText() )
+ .isNull();
assertThat( report.getValue().getName() )
.isNull();
+ assertThat( report.getValue().getNameText() )
+ .isNull();
assertThat( report.getValue().getStackTraceWriter() )
.isNull();
assertThat( report.getValue().getElapsed() )
.isNotNull();
+ assertThat( report.getValue().getSystemProperties() )
+ .isNotEmpty();
- verify( listener, never() ).testSucceeded( any() );
+ verify( listener, never() )
+ .testSucceeded(any() );
+
+ verifyNoMoreInteractions( listener );
}
@Test
@@ -438,6 +516,9 @@ public class RunListenerAdapterTest
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
verify( listener ).testStarting( entryCaptor.capture() );
assertEquals( parentDisplay, entryCaptor.getValue().getSourceName() );
+ assertNull(entryCaptor.getValue().getSourceText());
+ assertNull( entryCaptor.getValue().getName() );
+ assertNull( entryCaptor.getValue().getNameText() );
}
@Test
@@ -484,22 +565,8 @@ public class RunListenerAdapterTest
public void displayNamesIgnoredInReport()
throws NoSuchMethodException
{
- class TestMethodTestDescriptorWithDisplayName extends AbstractTestDescriptor
- {
- private TestMethodTestDescriptorWithDisplayName( UniqueId uniqueId, Class<?> testClass, Method testMethod )
- {
- super( uniqueId, "some display name", MethodSource.from( testClass, testMethod ) );
- }
-
- @Override
- public Type getType()
- {
- return Type.TEST;
- }
- }
-
TestMethodTestDescriptorWithDisplayName descriptor = new TestMethodTestDescriptorWithDisplayName( newId(),
- MyTestClass.class, MyTestClass.class.getDeclaredMethod( "myNamedTestMethod" ) );
+ MyTestClass.class, MyTestClass.class.getDeclaredMethod( "myNamedTestMethod" ), "some display name" );
TestIdentifier factoryIdentifier = TestIdentifier.from( descriptor );
ArgumentCaptor<ReportEntry> entryCaptor = ArgumentCaptor.forClass( ReportEntry.class );
@@ -509,7 +576,10 @@ public class RunListenerAdapterTest
ReportEntry value = entryCaptor.getValue();
- assertEquals( "some display name", value.getName() );
+ assertEquals( MyTestClass.class.getName(), value.getSourceName() );
+ assertNull(value.getSourceText());
+ assertEquals( "myNamedTestMethod", value.getName() );
+ assertEquals( "some display name", value.getNameText() );
}
private static TestIdentifier newMethodIdentifier()
@@ -584,18 +654,6 @@ public class RunListenerAdapterTest
return new EngineDescriptor( UniqueId.forEngine( "engine" ), "engine" );
}
- private TestDescriptor newTestDescriptor( UniqueId uniqueId, String displayName, Type type )
- {
- return new AbstractTestDescriptor( uniqueId, displayName )
- {
- @Override
- public Type getType()
- {
- return type;
- }
- };
- }
-
private static TestIdentifier identifiersAsParentOnTestPlan(
TestPlan plan, TestDescriptor parent, TestDescriptor child )
{
@@ -623,6 +681,7 @@ public class RunListenerAdapterTest
}
private static final String MY_TEST_METHOD_NAME = "myTestMethod";
+ private static final String MY_NAMED_TEST_METHOD_NAME = "myNamedTestMethod";
private static class MyTestClass
{
@@ -642,4 +701,19 @@ public class RunListenerAdapterTest
{
}
}
+
+ static class TestMethodTestDescriptorWithDisplayName extends AbstractTestDescriptor
+ {
+ private TestMethodTestDescriptorWithDisplayName( UniqueId uniqueId,
+ Class<?> testClass, Method testMethod, String displayName )
+ {
+ super( uniqueId, displayName, MethodSource.from( testClass, testMethod ) );
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.TEST;
+ }
+ }
}
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
index bfdb4eb..d44d92b 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnit3Provider.java
@@ -133,9 +133,9 @@ public class JUnit3Provider
Map<String, String> systemProperties )
throws TestSetFailedException
{
- reporter.testSetStarting( new SimpleReportEntry( testSet.getName(), null ) );
+ reporter.testSetStarting( new SimpleReportEntry( testSet.getName(), null, null, null ) );
testSet.execute( reporter, classLoader );
- reporter.testSetCompleted( new SimpleReportEntry( testSet.getName(), null, systemProperties ) );
+ reporter.testSetCompleted( new SimpleReportEntry( testSet.getName(), null, null, null, systemProperties ) );
}
private TestsToRun scanClassPath()
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
index 1b23322..7ee787e 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
@@ -116,7 +116,7 @@ public class PojoTestSet
final String userFriendlyMethodName = methodName + '(' + ( args.length == 0 ? "" : "Reporter" ) + ')';
final String testName = getTestName( userFriendlyMethodName );
- reportManager.testStarting( new SimpleReportEntry( testClassName, testName ) );
+ reportManager.testStarting( new SimpleReportEntry( testClassName, null, testName, null ) );
try
{
@@ -125,7 +125,7 @@ public class PojoTestSet
catch ( Throwable e )
{
StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, e );
- reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
+ reportManager.testFailed( withException( testClassName, null, testName, null, stackTraceWriter ) );
// A return value of true indicates to this class's executeTestMethods
// method that it should abort and not attempt to execute
@@ -139,20 +139,20 @@ public class PojoTestSet
try
{
method.invoke( testObject, args );
- reportManager.testSucceeded( new SimpleReportEntry( testClassName, testName ) );
+ reportManager.testSucceeded( new SimpleReportEntry( testClassName, null, testName, null ) );
}
catch ( InvocationTargetException e )
{
Throwable t = e.getTargetException();
StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, t );
- reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
+ reportManager.testFailed( withException( testClassName, null, testName, null, stackTraceWriter ) );
// Don't return here, because tearDownFixture should be called even
// if the test method throws an exception.
}
catch ( Throwable t )
{
StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, t );
- reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
+ reportManager.testFailed( withException( testClassName, null, testName, null, stackTraceWriter ) );
// Don't return here, because tearDownFixture should be called even
// if the test method throws an exception.
}
@@ -165,7 +165,7 @@ public class PojoTestSet
{
StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, t );
// Treat any exception from tearDownFixture as a failure of the test.
- reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
+ reportManager.testFailed( withException( testClassName, null, testName, null, stackTraceWriter ) );
// A return value of true indicates to this class's executeTestMethods
// method that it should abort and not attempt to execute
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
index e5d2232..db0563a 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
@@ -217,12 +217,12 @@ public class TestListenerInvocationHandler
String className = extractClassName( description );
String methodName = extractMethodName( description );
StackTraceWriter stackTraceWriter = toStackTraceWriter( args );
- return withException( className, methodName, stackTraceWriter );
+ return withException( className, null, methodName, null, stackTraceWriter );
}
private static SimpleReportEntry createStartEndReportEntry( Object[] args )
{
String description = args[0].toString();
- return new SimpleReportEntry( extractClassName( description ), extractMethodName( description ) );
+ return new SimpleReportEntry( extractClassName( description ), null, extractMethodName( description ), null );
}
}
diff --git a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
index f64b93d..b964933 100644
--- a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
+++ b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
@@ -231,7 +231,7 @@ public class JUnit4Provider
private void executeTestSet( Class<?> clazz, RunListener reporter, Notifier notifier )
{
- final SimpleReportEntry report = new SimpleReportEntry( clazz.getName(), null, systemProps() );
+ final SimpleReportEntry report = new SimpleReportEntry( clazz.getName(), null, null, null, systemProps() );
reporter.testSetStarting( report );
try
{
@@ -250,7 +250,7 @@ public class JUnit4Provider
String reportName = report.getName();
String reportSourceName = report.getSourceName();
PojoStackTraceWriter stackWriter = new PojoStackTraceWriter( reportSourceName, reportName, e );
- reporter.testError( withException( reportSourceName, reportName, stackWriter ) );
+ reporter.testError( withException( reportSourceName, null, reportName, null, stackWriter ) );
}
}
finally
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
index 4aaf1c8..135ba4e 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
@@ -65,13 +65,13 @@ public class NonConcurrentRunListener
protected SimpleReportEntry createReportEntry( Description description )
{
ClassMethod classMethod = toClassMethod( description );
- return new SimpleReportEntry( classMethod.getClazz(), classMethod.getMethod() );
+ return new SimpleReportEntry( classMethod.getClazz(), null, classMethod.getMethod(), null );
}
private TestSetReportEntry createReportEntryForTestSet( Description description, Map<String, String> systemProps )
{
ClassMethod classMethod = toClassMethod( description );
- return new SimpleReportEntry( classMethod.getClazz(), classMethod.getClazz(), systemProps );
+ return new SimpleReportEntry( classMethod.getClazz(), null, null, null, systemProps );
}
private TestSetReportEntry createTestSetReportEntryStarted( Description description )
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java
index e710cda..0ffcbe3 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestSet.java
@@ -120,7 +120,7 @@ public class TestSet
private TestSetReportEntry createReportEntry( Integer elapsed, Map<String, String> systemProps )
{
- return new SimpleReportEntry( testClassName, testClassName, null, elapsed, systemProps );
+ return new SimpleReportEntry( testClassName, null, testClassName, null, null, elapsed, systemProps );
}
public void incrementTestMethodCount()
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java
index cb50358..d2e1395 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/TestMethodTest.java
@@ -32,7 +32,7 @@ public class TestMethodTest
{
public void testTestFailure()
{
- ReportEntry reportEntry = new SimpleReportEntry( "a", "b" );
+ ReportEntry reportEntry = new SimpleReportEntry( "a", null, "b", null );
TestMethod testMethod = new TestMethod( reportEntry, new TestSet( TestMethodTest.class.getName() ) );
testMethod.testFailure( reportEntry );
final int elapsed = testMethod.getElapsed();
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
index 8cb7641..83c9d2b 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
@@ -73,7 +73,7 @@ public class TestNGReporter
@Override
public void onTestSuccess( ITestResult result )
{
- ReportEntry report = new SimpleReportEntry( result.getTestClass().getName(), result.getName() );
+ ReportEntry report = new SimpleReportEntry( result.getTestClass().getName(), null, result.getName(), null );
reporter.testSucceeded( report );
}
@@ -81,7 +81,7 @@ public class TestNGReporter
public void onTestFailure( ITestResult result )
{
IClass clazz = result.getTestClass();
- ReportEntry report = withException( clazz.getName(), result.getName(),
+ ReportEntry report = withException( clazz.getName(), null, result.getName(), null,
new PojoStackTraceWriter( clazz.getRealClass().getName(),
result.getMethod().getMethodName(),
result.getThrowable() ) );
@@ -92,9 +92,10 @@ public class TestNGReporter
@Override
public void onTestSkipped( ITestResult result )
{
+ //noinspection ThrowableResultOfMethodCallIgnored
Throwable t = result.getThrowable();
String reason = t == null ? null : t.getMessage();
- ReportEntry report = ignored( result.getTestClass().getName(), result.getName(), reason );
+ ReportEntry report = ignored( result.getTestClass().getName(), null, result.getName(), null, reason );
reporter.testSkipped( report );
}
@@ -102,7 +103,7 @@ public class TestNGReporter
public void onTestFailedButWithinSuccessPercentage( ITestResult result )
{
IClass clazz = result.getTestClass();
- ReportEntry report = withException( clazz.getName(), result.getName(),
+ ReportEntry report = withException( clazz.getName(), null, result.getName(), null,
new PojoStackTraceWriter( clazz.getRealClass().getName(),
result.getMethod().getMethodName(),
result.getThrowable() ) );
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestSuite.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestSuite.java
index ffd13ae..27f46be 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestSuite.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestSuite.java
@@ -43,7 +43,7 @@ abstract class TestSuite
final void startTestSuite( RunListener reporterManager )
{
- TestSetReportEntry report = new SimpleReportEntry( getSuiteName(), null );
+ TestSetReportEntry report = new SimpleReportEntry( getSuiteName(), null, null, null );
try
{
@@ -57,7 +57,7 @@ abstract class TestSuite
final void finishTestSuite( RunListener reporterManager )
{
- SimpleReportEntry report = new SimpleReportEntry( getSuiteName(), null, systemProps() );
+ SimpleReportEntry report = new SimpleReportEntry( getSuiteName(), null, null, null, systemProps() );
reporterManager.testSetCompleted( report );
}
}