Repository: maven-surefire Updated Branches: refs/heads/master 195e4833c -> c2a7d4b7f
[SUREFIRE-1305] surefire fails on parallel tests when newline character is in test description Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/c2a7d4b7 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/c2a7d4b7 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/c2a7d4b7 Branch: refs/heads/master Commit: c2a7d4b7f28b0fb5456b9871fd87cbac5c70cbd3 Parents: 195e483 Author: Tibor17 <tibo...@lycos.com> Authored: Fri Dec 2 02:51:07 2016 +0100 Committer: Tibor17 <tibo...@lycos.com> Committed: Fri Dec 2 02:51:07 2016 +0100 ---------------------------------------------------------------------- .../maven/surefire/common/junit4/JUnit4RunListener.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c2a7d4b7/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java ---------------------------------------------------------------------- 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 d3aa9a4..85e2acd 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 @@ -44,11 +44,7 @@ import static org.apache.maven.surefire.report.SimpleReportEntry.withException; public class JUnit4RunListener extends org.junit.runner.notification.RunListener { - private static final Pattern PARENS = Pattern.compile( "^" + ".+" //any character - + "\\((" - // then an open-paren (start matching a group) - + "[^\\\\(\\\\)]+" //non-parens - + ")\\)" + "$" ); + private static final Pattern METHOD_CLASS_PATTERN = Pattern.compile( "([\\s\\S]*)\\((.*)\\)" ); protected final RunListener reporter; @@ -188,8 +184,8 @@ public class JUnit4RunListener public static String extractClassName( Description description ) { String displayName = description.getDisplayName(); - Matcher m = PARENS.matcher( displayName ); - return m.find() ? m.group( 1 ) : displayName; + Matcher m = METHOD_CLASS_PATTERN.matcher( displayName ); + return m.matches() ? m.group( 2 ) : displayName; } public static String extractMethodName( Description description )