SUREFIRE-1217: Extract factory method for StatelessXmlReporter.
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/6a96365f Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/6a96365f Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/6a96365f Branch: refs/heads/SUREFIRE-1217 Commit: 6a96365f83dcab772cd3a2e5403c1e98a206bffa Parents: c78d238 Author: Mirko Friedenhagen <mfriedenha...@apache.org> Authored: Sun Jan 10 21:36:18 2016 +0100 Committer: Mirko Friedenhagen <mfriedenha...@apache.org> Committed: Wed Jan 13 07:05:33 2016 +0100 ---------------------------------------------------------------------- .../report/StatelessXmlReporterTest.java | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a96365f/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java index 643a291..c710a7e 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java @@ -84,7 +84,7 @@ public class StatelessXmlReporterTest public void testFileNameWithoutSuffix() { StatelessXmlReporter reporter = - createStatelessXmlReporter(); + createStatelessXmlReporter(0); reporter.cleanTestHistoryMap(); ReportEntry reportEntry = new SimpleReportEntry( getClass().getName(), getClass().getName(), 12 ); @@ -98,12 +98,6 @@ public class StatelessXmlReporterTest expectedReportFile.exists() ); } - StatelessXmlReporter createStatelessXmlReporter() { - return new StatelessXmlReporter( reportDir, null, false, 0, - new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>() ); - } - - public void testAllFieldsSerialized() throws IOException { @@ -141,8 +135,7 @@ public class StatelessXmlReporterTest ReportEntryType.ERROR, 13, stdOut, stdErr ); stats.testSucceeded( t2 ); - StatelessXmlReporter reporter = new StatelessXmlReporter( reportDir, null, false, 0, - new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>() ); + StatelessXmlReporter reporter = createStatelessXmlReporter(0); reporter.testSetCompleted( testSetReportEntry, stats ); FileInputStream fileInputStream = new FileInputStream( expectedReportFile ); @@ -175,6 +168,7 @@ public class StatelessXmlReporterTest assertEquals( stdErrPrefix + "?&-&£ &#0;&#31;", tcb.getChild( "system-err" ).getValue() ); } + public void testOutputRerunFlakyFailure() throws IOException { @@ -220,12 +214,7 @@ public class StatelessXmlReporterTest rerunStats.testSucceeded( testTwoSecondError ); rerunStats.testSucceeded( testThreeSecondRun ); - StatelessXmlReporter reporter = - new StatelessXmlReporter( reportDir, - null, - false, - 1, - new HashMap<String, Map<String, List<WrappedReportEntry>>>() ); + StatelessXmlReporter reporter = createStatelessXmlReporter(1); reporter.testSetCompleted( testSetReportEntry, stats ); reporter.testSetCompleted( testSetReportEntry, rerunStats ); @@ -283,6 +272,11 @@ public class StatelessXmlReporterTest assertNull( testCaseThree.getChild( "system-err" ) ); } + StatelessXmlReporter createStatelessXmlReporter(int rerunFailingTestCount) { + return new StatelessXmlReporter( reportDir, null, false, rerunFailingTestCount, + new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>() ); + } + private boolean defaultCharsetSupportsSpecialChar() { // some charsets are not able to deal with \u0115 on both ways of the conversion