From ce01353cbb059c603533eb1479f98e9ae9c31d4b Mon Sep 17 00:00:00 2001 From: lanlingxueyu <3252181514@qq.com> Date: Wed, 12 Dec 2018 09:33:13 +0800 Subject: [PATCH] Update StatelessXmlReporter.java Sort methodRunHistoryMap --- .../surefire/report/StatelessXmlReporter.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 45f1c5003c..432af04b66 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 @@ -34,6 +34,8 @@ import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.Deque; import java.util.LinkedHashMap; import java.util.List; @@ -151,7 +153,22 @@ public void testSetCompleted( WrappedReportEntry testSetReportEntry, TestSetStat showProperties( ppw, testSetReportEntry.getSystemProperties() ); - for ( Entry>> statistics : classMethodStatistics.entrySet() ) + List>>> classMethodStatisticsEntries = + new ArrayList<>( classMethodStatistics.entrySet() ); + + Collections.sort( classMethodStatisticsEntries, + new Comparator>>>() + { + @Override + public int compare( Entry>> o1, + Entry>> o2 ) + { + return o1.getKey().compareTo( o2.getKey() ); + } + } + ); + + for ( Entry>> statistics : classMethodStatisticsEntries ) { for ( Entry> thisMethodRuns : statistics.getValue().entrySet() ) {