You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2014/03/09 20:42:13 UTC
[09/11] git commit: [SUREFIRE-1062] TestNG listeners on separate
lines in pom.xml
[SUREFIRE-1062] TestNG listeners on separate lines in pom.xml
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/a1d86c7d
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/a1d86c7d
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/a1d86c7d
Branch: refs/heads/master
Commit: a1d86c7d63b90e397c39db0efc008ad47cef0239
Parents: 4f97226
Author: Kirill Kozlov <ko...@gmail.com>
Authored: Mon Feb 24 23:14:20 2014 +0400
Committer: Andreas Gudian <ag...@apache.org>
Committed: Sun Mar 9 20:17:08 2014 +0100
----------------------------------------------------------------------
.../testng/conf/AbstractDirectConfigurator.java | 2 +-
.../testng/conf/TestNGMapConfiguratorTest.java | 26 ++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a1d86c7d/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
index 3c1e95e..b344d3d 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/AbstractDirectConfigurator.java
@@ -119,7 +119,7 @@ public abstract class AbstractDirectConfigurator
}
List classes = new ArrayList();
- String[] classNames = listenerClasses.split( " *, *" );
+ String[] classNames = listenerClasses.split( "\\s*,\\s*(\\r?\\n)?\\s*" );
for ( int i = 0; i < classNames.length; i++ )
{
String className = classNames[i];
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a1d86c7d/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java b/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
index ac785a6..556ebea 100755
--- a/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
+++ b/surefire-providers/surefire-testng/src/test/java/org/apache/maven/surefire/testng/conf/TestNGMapConfiguratorTest.java
@@ -20,7 +20,9 @@ package org.apache.maven.surefire.testng.conf;
*/
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+
import org.apache.maven.surefire.testset.TestSetFailedException;
import junit.framework.TestCase;
@@ -31,6 +33,10 @@ import junit.framework.TestCase;
public class TestNGMapConfiguratorTest
extends TestCase
{
+ private static final String FIRST_LISTENER = "org.testng.TestListenerAdapter";
+ private static final String SECOND_LISTENER = "org.testng.reporters.ExitCodeListener";
+ public static final String LISTENER_PROP = "listener";
+
public void testGetConvertedOptions()
throws Exception
{
@@ -39,6 +45,26 @@ public class TestNGMapConfiguratorTest
assertTrue( bool.booleanValue() );
}
+ public void testListenersOnSeparateLines()
+ throws Exception
+ {
+ String listenersOnSeveralLines = String.format( "%s , %n %s",
+ FIRST_LISTENER, SECOND_LISTENER);
+ Map convertedOptions = getConvertedOptions(LISTENER_PROP, listenersOnSeveralLines);
+ List listeners = (List) convertedOptions.get( String.format("-%s", LISTENER_PROP));
+ assertEquals(2, listeners.size());
+ }
+
+ public void testListenersOnTheSameLine()
+ throws Exception
+ {
+ String listenersOnSeveralLines = String.format( "%s,%s",
+ FIRST_LISTENER, SECOND_LISTENER);
+ Map convertedOptions = getConvertedOptions( LISTENER_PROP, listenersOnSeveralLines);
+ List listeners = (List) convertedOptions.get( String.format("-%s", LISTENER_PROP));
+ assertEquals(2, listeners.size());
+ }
+
public void testGroupByInstances()
throws Exception
{