1 package org.apache.maven.surefire.testng.conf;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.surefire.testset.TestSetFailedException;
23
24
25
26
27 public class TestNG513Configurator
28 extends TestNG510Configurator
29 {
30
31 @Override
32 protected Object convertReporterConfig( Object val )
33 {
34 return val;
35 }
36
37 @Override
38 protected Object convertListeners( String listenerClasses ) throws TestSetFailedException
39 {
40 return convertListenersString( listenerClasses );
41 }
42
43 static String convertListenersString( String listenerClasses )
44 {
45 if ( listenerClasses == null || "".equals( listenerClasses.trim() ) )
46 {
47 return listenerClasses;
48 }
49
50 StringBuilder sb = new StringBuilder();
51 String[] classNames = listenerClasses.split( "\\s*,\\s*(\\r?\\n)?\\s*" );
52 for ( int i = 0; i < classNames.length; i++ )
53 {
54 String className = classNames[i];
55 sb.append( className );
56 if ( i < classNames.length - 1 )
57 {
58 sb.append( ',' );
59 }
60 }
61
62 return sb.toString();
63 }
64 }