Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a6e6634

Browse files
committedMar 13, 2022
Surefire Report Sort test methods
1 parent 68bca29 commit a6e6634

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
import java.io.OutputStreamWriter;
3535
import java.io.PrintWriter;
3636
import java.util.ArrayList;
37+
import java.util.Comparator;
3738
import java.util.Deque;
3839
import java.util.LinkedHashMap;
3940
import java.util.List;
4041
import java.util.Map;
4142
import java.util.Map.Entry;
4243
import java.util.StringTokenizer;
44+
import java.util.TreeMap;
4345
import java.util.concurrent.ConcurrentLinkedDeque;
4446

4547
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -181,7 +183,15 @@ private Map<String, Map<String, List<WrappedReportEntry>>> arrangeMethodStatisti
181183
Map<String, List<WrappedReportEntry>> stats = classMethodStatistics.get( testClassName );
182184
if ( stats == null )
183185
{
184-
stats = new LinkedHashMap<>();
186+
stats = new TreeMap( new Comparator<String>()
187+
{
188+
@Override
189+
public int compare( String s1,
190+
String s2 )
191+
{
192+
return s1.compareTo( s2 );
193+
}
194+
} );
185195
classMethodStatistics.put( testClassName, stats );
186196
}
187197
String methodName = methodEntry.getName();

0 commit comments

Comments
 (0)
Please sign in to comment.