Skip to content

Commit ce01353

Browse files
lanlingxueyunhojpatrick
authored andcommitted
Update StatelessXmlReporter.java
Sort methodRunHistoryMap
1 parent 68bca29 commit ce01353

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

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

+18-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import java.io.OutputStreamWriter;
3535
import java.io.PrintWriter;
3636
import java.util.ArrayList;
37+
import java.util.Collections;
38+
import java.util.Comparator;
3739
import java.util.Deque;
3840
import java.util.LinkedHashMap;
3941
import java.util.List;
@@ -151,7 +153,22 @@ public void testSetCompleted( WrappedReportEntry testSetReportEntry, TestSetStat
151153

152154
showProperties( ppw, testSetReportEntry.getSystemProperties() );
153155

154-
for ( Entry<String, Map<String, List<WrappedReportEntry>>> statistics : classMethodStatistics.entrySet() )
156+
List<Entry<String, Map<String, List<WrappedReportEntry>>>> classMethodStatisticsEntries =
157+
new ArrayList<>( classMethodStatistics.entrySet() );
158+
159+
Collections.sort( classMethodStatisticsEntries,
160+
new Comparator<Entry<String, Map<String, List<WrappedReportEntry>>>>()
161+
{
162+
@Override
163+
public int compare( Entry<String, Map<String, List<WrappedReportEntry>>> o1,
164+
Entry<String, Map<String, List<WrappedReportEntry>>> o2 )
165+
{
166+
return o1.getKey().compareTo( o2.getKey() );
167+
}
168+
}
169+
);
170+
171+
for ( Entry<String, Map<String, List<WrappedReportEntry>>> statistics : classMethodStatisticsEntries )
155172
{
156173
for ( Entry<String, List<WrappedReportEntry>> thisMethodRuns : statistics.getValue().entrySet() )
157174
{

0 commit comments

Comments
 (0)