http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java index 7ec390e..b7bcadb 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java @@ -63,6 +63,7 @@ public class TestSetRunListener private final StatisticsReporter statisticsReporter; + @SuppressWarnings( "checkstyle:parameternumber" ) public TestSetRunListener( ConsoleReporter consoleReporter, FileReporter fileReporter, StatelessXmlReporter simpleXMLReporter, TestcycleConsoleOutputReceiver consoleOutputReceiver, @@ -169,7 +170,7 @@ public class TestSetRunListener public void testSucceeded( ReportEntry reportEntry ) { - WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.success ); + WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.SUCCESS ); detailsForThis.testSucceeded( wrapped ); if ( statisticsReporter != null ) { @@ -180,7 +181,7 @@ public class TestSetRunListener public void testError( ReportEntry reportEntry ) { - WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.error ); + WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.ERROR ); detailsForThis.testError( wrapped ); if ( statisticsReporter != null ) { @@ -191,7 +192,7 @@ public class TestSetRunListener public void testFailed( ReportEntry reportEntry ) { - WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.failure ); + WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.FAILURE ); detailsForThis.testFailure( wrapped ); if ( statisticsReporter != null ) { @@ -206,7 +207,7 @@ public class TestSetRunListener public void testSkipped( ReportEntry reportEntry ) { - WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.skipped ); + WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.SKIPPED ); detailsForThis.testSkipped( wrapped ); if ( statisticsReporter != null ) @@ -224,7 +225,7 @@ public class TestSetRunListener private WrappedReportEntry wrap( ReportEntry other, ReportEntryType reportEntryType ) { final int estimatedElapsed; - if ( reportEntryType != ReportEntryType.skipped ) + if ( reportEntryType != ReportEntryType.SKIPPED ) { if ( other.getElapsed() != null ) { @@ -260,7 +261,7 @@ public class TestSetRunListener public void addTestMethodStats() { - for (WrappedReportEntry reportEntry : detailsForThis.getReportEntries()) + for ( WrappedReportEntry reportEntry : detailsForThis.getReportEntries() ) { TestMethodStats methodStats = new TestMethodStats( reportEntry.getClassMethodName(), reportEntry.getReportEntryType(),
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java index 8391ff9..2ff40ba 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java @@ -1,4 +1,5 @@ package org.apache.maven.plugin.surefire.report; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -82,12 +83,14 @@ public class TestSetStats public void testSetStart() { - lastStartAt = testSetStartAt = System.currentTimeMillis(); + testSetStartAt = System.currentTimeMillis(); + lastStartAt = testSetStartAt; } public void testStart() { - lastStartAt = testStartAt = System.currentTimeMillis(); + testStartAt = System.currentTimeMillis(); + lastStartAt = testStartAt; } private long finishTest( WrappedReportEntry reportEntry ) http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java index af1682f..954a2bb 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/Utf8RecodingDeferredFileOutputStream.java @@ -41,6 +41,7 @@ class Utf8RecodingDeferredFileOutputStream private static final Charset UTF8 = Charset.forName( "UTF-8" ); + @SuppressWarnings( "checkstyle:magicnumber" ) public Utf8RecodingDeferredFileOutputStream( String channel ) { this.deferredFileOutputStream = new DeferredFileOutputStream( 1000000, channel, "deferred", null ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java index ef6961d..f62a917 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java @@ -48,7 +48,8 @@ public class WrappedReportEntry static final String NL = System.getProperty( "line.separator" ); public WrappedReportEntry( ReportEntry original, ReportEntryType reportEntryType, Integer estimatedElapsed, - Utf8RecodingDeferredFileOutputStream stdout, Utf8RecodingDeferredFileOutputStream stdErr ) + Utf8RecodingDeferredFileOutputStream stdout, + Utf8RecodingDeferredFileOutputStream stdErr ) { this.original = original; this.reportEntryType = reportEntryType; @@ -165,17 +166,17 @@ public class WrappedReportEntry public boolean isErrorOrFailure() { ReportEntryType thisType = getReportEntryType(); - return ReportEntryType.failure == thisType || ReportEntryType.error == thisType; + return ReportEntryType.FAILURE == thisType || ReportEntryType.ERROR == thisType; } public boolean isSkipped() { - return ReportEntryType.skipped == getReportEntryType(); + return ReportEntryType.SKIPPED == getReportEntryType(); } public boolean isSucceeded() { - return ReportEntryType.success == getReportEntryType(); + return ReportEntryType.SUCCESS == getReportEntryType(); } public String getNameWithGroup() http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java index 636662f..60c1d49 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DependencyScanner.java @@ -18,6 +18,7 @@ package org.apache.maven.plugin.surefire.util; * specific language governing permissions and limitations * under the License. */ + import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertJarFileResourceToJavaClassName; import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertSlashToSystemFileSeparator; import static org.apache.maven.plugin.surefire.util.ScannerUtil.processIncludesExcludes; @@ -40,7 +41,7 @@ import javax.annotation.Nullable; /** * Scans dependencies looking for tests. - * + * * @author Aslak Knutsen */ public class DependencyScanner @@ -50,11 +51,13 @@ public class DependencyScanner protected final List<String> includes; + @SuppressWarnings( "checkstyle:modifierorder" ) protected final @Nonnull List<String> excludes; protected final List<String> specificTests; - public DependencyScanner( List<File> dependenciesToScan, List<String> includes, @Nonnull List<String> excludes, List<String> specificTests ) + public DependencyScanner( List<File> dependenciesToScan, List<String> includes, @Nonnull List<String> excludes, + List<String> specificTests ) { this.dependenciesToScan = dependenciesToScan; this.includes = includes; @@ -130,9 +133,8 @@ public class DependencyScanner String[] groupArtifact = groups.split( ":" ); if ( groupArtifact.length != 2 ) { - throw new IllegalArgumentException( - "dependencyToScan argument should be in format 'groupid:artifactid': " - + groups ); + throw new IllegalArgumentException( "dependencyToScan argument should be in format" + + " 'groupid:artifactid': " + groups ); } if ( artifact.getGroupId().matches( groupArtifact[0] ) && artifact.getArtifactId().matches( groupArtifact[1] ) ) @@ -153,7 +155,8 @@ public class DependencyScanner private SpecificFileFilter specificTestFilter; - public Matcher( @Nullable List<String> includes, @Nonnull List<String> excludes, @Nullable List<String> specificTests ) + public Matcher( @Nullable List<String> includes, @Nonnull List<String> excludes, + @Nullable List<String> specificTests ) { String[] specific = specificTests == null ? new String[0] : processIncludesExcludes( specificTests ); specificTestFilter = new SpecificFileFilter( specific ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DirectoryScanner.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DirectoryScanner.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DirectoryScanner.java index e0cc18d..01fcc51 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DirectoryScanner.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/DirectoryScanner.java @@ -18,6 +18,7 @@ package org.apache.maven.plugin.surefire.util; * specific language governing permissions and limitations * under the License. */ + import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertSlashToSystemFileSeparator; import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertToJavaClassName; import static org.apache.maven.plugin.surefire.util.ScannerUtil.processIncludesExcludes; @@ -79,7 +80,9 @@ public class DirectoryScanner scanner.scan(); for ( String test : scanner.getIncludedFiles() ) { - if ( specificTestFilter.accept( convertSlashToSystemFileSeparator( stripBaseDir( basedir.getAbsolutePath(), test ) ) ) ) + if ( specificTestFilter.accept( + convertSlashToSystemFileSeparator( + stripBaseDir( basedir.getAbsolutePath(), test ) ) ) ) { result.add( convertToJavaClassName( test ) ); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/Relocator.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/Relocator.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/Relocator.java index d61ee20..eb5964c 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/Relocator.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/Relocator.java @@ -30,9 +30,10 @@ import javax.annotation.Nullable; */ public class Relocator { + @SuppressWarnings( "checkstyle:modifierorder" ) private final @Nullable String relocation; - private static final String relocationBase = "org.apache.maven.surefire."; + private static final String RELOCATION_BASE = "org.apache.maven.surefire."; public Relocator( @Nullable String relocation ) @@ -45,11 +46,13 @@ public class Relocator relocation = "shadefire"; } + @SuppressWarnings( "checkstyle:modifierorder" ) private @Nullable String getRelocation() { return relocation; } + @SuppressWarnings( "checkstyle:modifierorder" ) public @Nonnull String relocate( @Nonnull String className ) { if ( relocation == null ) @@ -61,7 +64,7 @@ public class Relocator return className; } String rest = className.substring( "org.apache.maven.surefire.".length() ); - final String s = relocationBase + getRelocation() + "."; + final String s = RELOCATION_BASE + getRelocation() + "."; return s + rest; } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/ScannerUtil.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/ScannerUtil.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/ScannerUtil.java index 124f656..e3ff45d 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/ScannerUtil.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/ScannerUtil.java @@ -27,38 +27,46 @@ import org.apache.commons.lang3.StringUtils; import javax.annotation.Nonnull; -final class ScannerUtil { +final class ScannerUtil +{ - private ScannerUtil() {} + private ScannerUtil() + { + } private static final String FS = System.getProperty( "file.separator" ); private static final String JAVA_SOURCE_FILE_EXTENSION = ".java"; private static final String JAVA_CLASS_FILE_EXTENSION = ".class"; - - private static final boolean IS_NON_UNIX_FS = (!FS.equals( "/" )); + private static final boolean IS_NON_UNIX_FS = ( !FS.equals( "/" ) ); + + @SuppressWarnings( "checkstyle:modifierorder" ) public static @Nonnull String convertToJavaClassName( @Nonnull String test ) { return StringUtils.removeEnd( test, ".class" ).replace( FS, "." ); } + @SuppressWarnings( "checkstyle:modifierorder" ) public static @Nonnull String convertJarFileResourceToJavaClassName( @Nonnull String test ) { return StringUtils.removeEnd( test, ".class" ).replace( "/", "." ); } + @SuppressWarnings( "checkstyle:modifierorder" ) public static @Nonnull String convertSlashToSystemFileSeparator( @Nonnull String path ) { return ( IS_NON_UNIX_FS ? path.replace( "/", FS ) : path ); } + @SuppressWarnings( "checkstyle:modifierorder" ) public static @Nonnull String stripBaseDir( String basedir, String test ) { return StringUtils.removeStart( test, basedir ); } + @SuppressWarnings( "checkstyle:modifierorder" ) public static @Nonnull String[] processIncludesExcludes( @Nonnull List<String> list ) { List<String> newList = new ArrayList<String>(); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java index db2d477..f168d32 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/util/SpecificFileFilter.java @@ -28,6 +28,10 @@ import org.apache.maven.shared.utils.io.SelectorUtils; import static org.apache.maven.plugin.surefire.util.ScannerUtil.convertSlashToSystemFileSeparator; +/** + * filters file names by a given collection of class name patterns + * + */ public class SpecificFileFilter { http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java b/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java index feba245..d73238a 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java @@ -44,7 +44,8 @@ public class SurefireReportParser { private static final String INCLUDES = "*.xml"; - private static final String EXCLUDES = "*.txt, testng-failed.xml, testng-failures.xml, testng-results.xml, failsafe-summary*.xml"; + private static final String EXCLUDES = + "*.txt, testng-failed.xml, testng-failures.xml, testng-results.xml, failsafe-summary*.xml"; private NumberFormat numberFormat = NumberFormat.getInstance(); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java b/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java index 3f600b2..2548b13 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java @@ -22,7 +22,6 @@ package org.apache.maven.plugins.surefire.report; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.text.NumberFormat; import java.text.ParseException; @@ -125,7 +124,8 @@ public class TestSuiteXmlParser { if ( "testsuite".equals( qName ) ) { - currentSuite = defaultSuite = new ReportTestSuite(); + defaultSuite = new ReportTestSuite(); + currentSuite = defaultSuite; try { http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java b/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java index 926658f..bcd5286 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/surefire/report/RunStatistics.java @@ -22,13 +22,6 @@ package org.apache.maven.surefire.report; import org.apache.maven.plugin.surefire.report.TestSetStats; import org.apache.maven.surefire.suite.RunResult; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - /** * @author Kristian Rosenvold */ http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java index 5bb1b61..1c18283 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java @@ -1,5 +1,24 @@ package org.apache.maven.plugin.surefire.report; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import junit.framework.TestCase; import org.apache.maven.plugin.surefire.StartupReportConfiguration; import org.apache.maven.surefire.report.DefaultDirectConsoleReporter; @@ -40,29 +59,29 @@ public class DefaultReporterFactoryTest // First run, four tests failed and one passed List<TestMethodStats> firstRunStats = new ArrayList<TestMethodStats>(); - firstRunStats.add( new TestMethodStats( TEST_ONE, ReportEntryType.error, new DummyStackTraceWriter( ERROR ) ) ); - firstRunStats.add( new TestMethodStats( TEST_TWO, ReportEntryType.error, new DummyStackTraceWriter( ERROR ) ) ); + firstRunStats.add( new TestMethodStats( TEST_ONE, ReportEntryType.ERROR, new DummyStackTraceWriter( ERROR ) ) ); + firstRunStats.add( new TestMethodStats( TEST_TWO, ReportEntryType.ERROR, new DummyStackTraceWriter( ERROR ) ) ); firstRunStats.add( - new TestMethodStats( TEST_THREE, ReportEntryType.failure, new DummyStackTraceWriter( ASSERTION_FAIL ) ) ); + new TestMethodStats( TEST_THREE, ReportEntryType.FAILURE, new DummyStackTraceWriter( ASSERTION_FAIL ) ) ); firstRunStats.add( - new TestMethodStats( TEST_FOUR, ReportEntryType.failure, new DummyStackTraceWriter( ASSERTION_FAIL ) ) ); + new TestMethodStats( TEST_FOUR, ReportEntryType.FAILURE, new DummyStackTraceWriter( ASSERTION_FAIL ) ) ); firstRunStats.add( - new TestMethodStats( TEST_FIVE, ReportEntryType.success, null ) ); + new TestMethodStats( TEST_FIVE, ReportEntryType.SUCCESS, null ) ); // Second run, two tests passed List<TestMethodStats> secondRunStats = new ArrayList<TestMethodStats>(); secondRunStats.add( - new TestMethodStats( TEST_ONE, ReportEntryType.failure, new DummyStackTraceWriter( ASSERTION_FAIL ) ) ); - secondRunStats.add( new TestMethodStats( TEST_TWO, ReportEntryType.success, null ) ); + new TestMethodStats( TEST_ONE, ReportEntryType.FAILURE, new DummyStackTraceWriter( ASSERTION_FAIL ) ) ); + secondRunStats.add( new TestMethodStats( TEST_TWO, ReportEntryType.SUCCESS, null ) ); secondRunStats.add( - new TestMethodStats( TEST_THREE, ReportEntryType.error, new DummyStackTraceWriter( ERROR ) ) ); - secondRunStats.add( new TestMethodStats( TEST_FOUR, ReportEntryType.success, null ) ); + new TestMethodStats( TEST_THREE, ReportEntryType.ERROR, new DummyStackTraceWriter( ERROR ) ) ); + secondRunStats.add( new TestMethodStats( TEST_FOUR, ReportEntryType.SUCCESS, null ) ); // Third run, another test passed List<TestMethodStats> thirdRunStats = new ArrayList<TestMethodStats>(); - thirdRunStats.add( new TestMethodStats( TEST_ONE, ReportEntryType.success, null ) ); + thirdRunStats.add( new TestMethodStats( TEST_ONE, ReportEntryType.SUCCESS, null ) ); thirdRunStats.add( - new TestMethodStats( TEST_THREE, ReportEntryType.error, new DummyStackTraceWriter( ERROR ) ) ); + new TestMethodStats( TEST_THREE, ReportEntryType.ERROR, new DummyStackTraceWriter( ERROR ) ) ); TestSetRunListener firstRunListener = mock( TestSetRunListener.class ); TestSetRunListener secondRunListener = mock( TestSetRunListener.class ); @@ -138,33 +157,33 @@ public class DefaultReporterFactoryTest assertEquals( unknown, factory.getTestResultType( emptyList ) ); List<ReportEntryType> successList = new ArrayList<ReportEntryType>(); - successList.add( ReportEntryType.success ); - successList.add( ReportEntryType.success ); + successList.add( ReportEntryType.SUCCESS ); + successList.add( ReportEntryType.SUCCESS ); assertEquals( success, factory.getTestResultType( successList ) ); List<ReportEntryType> failureErrorList = new ArrayList<ReportEntryType>(); - failureErrorList.add( ReportEntryType.failure ); - failureErrorList.add( ReportEntryType.error ); + failureErrorList.add( ReportEntryType.FAILURE ); + failureErrorList.add( ReportEntryType.ERROR ); assertEquals( failure, factory.getTestResultType( failureErrorList ) ); List<ReportEntryType> errorFailureList = new ArrayList<ReportEntryType>(); - errorFailureList.add( ReportEntryType.error ); - errorFailureList.add( ReportEntryType.failure ); + errorFailureList.add( ReportEntryType.ERROR ); + errorFailureList.add( ReportEntryType.FAILURE ); assertEquals( error, factory.getTestResultType( errorFailureList ) ); List<ReportEntryType> flakeList = new ArrayList<ReportEntryType>(); - flakeList.add( ReportEntryType.success ); - flakeList.add( ReportEntryType.failure ); + flakeList.add( ReportEntryType.SUCCESS ); + flakeList.add( ReportEntryType.FAILURE ); assertEquals( flake, factory.getTestResultType( flakeList ) ); flakeList = new ArrayList<ReportEntryType>(); - flakeList.add( ReportEntryType.error ); - flakeList.add( ReportEntryType.success ); - flakeList.add( ReportEntryType.failure ); + flakeList.add( ReportEntryType.ERROR ); + flakeList.add( ReportEntryType.SUCCESS ); + flakeList.add( ReportEntryType.FAILURE ); assertEquals( flake, factory.getTestResultType( flakeList ) ); List<ReportEntryType> skippedList = new ArrayList<ReportEntryType>(); - skippedList.add( ReportEntryType.skipped ); + skippedList.add( ReportEntryType.SKIPPED ); assertEquals( skipped, factory.getTestResultType( skippedList ) ); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 c6c1d15..4facf9e 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 @@ -82,7 +82,7 @@ public class StatelessXmlReporterTest String testName = "org.apache.maven.plugin.surefire.report.StatelessXMLReporterTest"; reportEntry = new SimpleReportEntry( this.getClass().getName(), testName, 12 ); WrappedReportEntry testSetReportEntry = - new WrappedReportEntry( reportEntry, ReportEntryType.success, 12, null, null ); + new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null ); stats.testSucceeded( testSetReportEntry ); reporter.testSetCompleted( testSetReportEntry, stats ); @@ -99,7 +99,7 @@ public class StatelessXmlReporterTest reportEntry = new SimpleReportEntry( this.getClass().getName(), TEST_ONE, 12 ); WrappedReportEntry testSetReportEntry = - new WrappedReportEntry( reportEntry, ReportEntryType.success, 12, null, null ); + new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null ); expectedReportFile = new File( reportDir, "TEST-" + TEST_ONE + ".xml" ); stats.testSucceeded( testSetReportEntry ); @@ -128,7 +128,7 @@ public class StatelessXmlReporterTest stdErr.write( stdErrBytes, 0, stdErrBytes.length ); WrappedReportEntry t2 = new WrappedReportEntry( new SimpleReportEntry( Inner.class.getName(), TEST_TWO, stackTraceWriter, 13 ), - ReportEntryType.error, 13, stdOut, stdErr ); + ReportEntryType.ERROR, 13, stdOut, stdErr ); stats.testSucceeded( t2 ); StatelessXmlReporter reporter = new StatelessXmlReporter( new File( "." ), null, false, 0 ); @@ -171,7 +171,7 @@ public class StatelessXmlReporterTest reportEntry = new SimpleReportEntry( this.getClass().getName(), TEST_ONE, 12 ); WrappedReportEntry testSetReportEntry = - new WrappedReportEntry( reportEntry, ReportEntryType.success, 12, null, null ); + new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null ); expectedReportFile = new File( reportDir, "TEST-" + TEST_ONE + ".xml" ); stats.testSucceeded( testSetReportEntry ); @@ -187,22 +187,22 @@ public class StatelessXmlReporterTest WrappedReportEntry testTwoFirstError = new WrappedReportEntry( new SimpleReportEntry( Inner.class.getName(), TEST_TWO, stackTraceWriterOne, 5 ), - ReportEntryType.error, 5, createStdOutput( firstRunOut ), + ReportEntryType.ERROR, 5, createStdOutput( firstRunOut ), createStdOutput( firstRunErr ) ); WrappedReportEntry testTwoSecondError = new WrappedReportEntry( new SimpleReportEntry( Inner.class.getName(), TEST_TWO, stackTraceWriterTwo, 13 ), - ReportEntryType.error, 13, createStdOutput( secondRunOut ), + ReportEntryType.ERROR, 13, createStdOutput( secondRunOut ), createStdOutput( secondRunErr ) ); WrappedReportEntry testThreeFirstRun = new WrappedReportEntry( new SimpleReportEntry( Inner.class.getName(), TEST_THREE, stackTraceWriterOne, 13 ), - ReportEntryType.failure, 13, createStdOutput( firstRunOut ), + ReportEntryType.FAILURE, 13, createStdOutput( firstRunOut ), createStdOutput( firstRunErr ) ); WrappedReportEntry testThreeSecondRun = new WrappedReportEntry( new SimpleReportEntry( Inner.class.getName(), TEST_THREE, stackTraceWriterTwo, 2 ), - ReportEntryType.success, 2, createStdOutput( secondRunOut ), + ReportEntryType.SUCCESS, 2, createStdOutput( secondRunOut ), createStdOutput( secondRunErr ) ); stats.testSucceeded( testTwoFirstError ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java ---------------------------------------------------------------------- diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java index b2877b1..7c49547 100644 --- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java +++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java @@ -43,7 +43,7 @@ public class FileReporterTest File reportDir = new File( "target" ); reportEntry = new SimpleReportEntry( this.getClass().getName(), testName ); WrappedReportEntry wrappedReportEntry = - new WrappedReportEntry( reportEntry, ReportEntryType.success, 12, null, null ); + new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null ); reporter = new FileReporter( reportDir, null ); reporter.testSetCompleted( wrappedReportEntry, createTestSetStats(), new ArrayList<String>() ); @@ -64,7 +64,7 @@ public class FileReporterTest String suffixText = "sampleSuffixText"; reportEntry = new SimpleReportEntry( this.getClass().getName(), testName ); WrappedReportEntry wrappedReportEntry = - new WrappedReportEntry( reportEntry, ReportEntryType.success, 12, null, null ); + new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null ); reporter = new FileReporter( reportDir, suffixText ); reporter.testSetCompleted( wrappedReportEntry, createTestSetStats(), new ArrayList<String>() ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java ---------------------------------------------------------------------- diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java index 0b8d030..ea6f9df 100644 --- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java +++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java @@ -64,8 +64,8 @@ public class SurefirePlugin * This parameter overrides the <code>includes/excludes</code> parameters, and the TestNG <code>suiteXmlFiles</code> * parameter. * <p/> - * Since 2.7.3, you can execute a limited number of methods in the test by adding #myMethod or #my*ethod. For example, - * "-Dtest=MyTest#myMethod". This is supported for junit 4.x and testNg. + * Since 2.7.3, you can execute a limited number of methods in the test by adding #myMethod or #my*ethod. For + * example, "-Dtest=MyTest#myMethod". This is supported for junit 4.x and testNg. */ @Parameter( property = "test" ) private String test; @@ -145,7 +145,7 @@ public class SurefirePlugin */ @Parameter( property = "surefire.parallel.forcedTimeout" ) private double parallelTestsTimeoutForcedInSeconds; - + /** * A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not * specified and when the <code>test</code> parameter is not specified, the default includes will be <code><br/> @@ -195,7 +195,8 @@ public class SurefirePlugin @Parameter( property = "surefire.rerunFailingTestsCount", defaultValue = "0" ) protected int rerunFailingTestsCount; - protected int getRerunFailingTestsCount() { + protected int getRerunFailingTestsCount() + { return rerunFailingTestsCount; } @@ -341,7 +342,7 @@ public class SurefirePlugin String singleTest = aTestArray; int index = singleTest.indexOf( '#' ); if ( index >= 0 ) - {// the way version 2.7.3. support single test method + { // the way version 2.7.3. support single test method singleTest = singleTest.substring( 0, index ); } tests.append( singleTest ); @@ -368,7 +369,7 @@ public class SurefirePlugin { String testStrAfterFirstSharp = this.test.substring( index + 1, this.test.length() ); if ( !testStrAfterFirstSharp.contains( "+" ) ) - {//the original way + { //the original way return testStrAfterFirstSharp; } else @@ -464,19 +465,23 @@ public class SurefirePlugin this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds; } - public double getParallelTestsTimeoutInSeconds() { + public double getParallelTestsTimeoutInSeconds() + { return parallelTestsTimeoutInSeconds; } - public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds ) { + public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds ) + { this.parallelTestsTimeoutInSeconds = parallelTestsTimeoutInSeconds; } - public double getParallelTestsTimeoutForcedInSeconds() { + public double getParallelTestsTimeoutForcedInSeconds() + { return parallelTestsTimeoutForcedInSeconds; } - public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds ) { + public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds ) + { this.parallelTestsTimeoutForcedInSeconds = parallelTestsTimeoutForcedInSeconds; } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-plugin/src/site/markdown/newerrorsummary.md ---------------------------------------------------------------------- diff --git a/maven-surefire-plugin/src/site/markdown/newerrorsummary.md b/maven-surefire-plugin/src/site/markdown/newerrorsummary.md index cb76287..7467aa9 100644 --- a/maven-surefire-plugin/src/site/markdown/newerrorsummary.md +++ b/maven-surefire-plugin/src/site/markdown/newerrorsummary.md @@ -1,3 +1,22 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + The 1-line error summary ======================== http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java index 25d3468..8235856 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java @@ -49,7 +49,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(property = "project.reporting.outputDirectory") + @Parameter( property = "project.reporting.outputDirectory" ) private File outputDirectory; /** @@ -65,7 +65,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(property = "project", required = true, readonly = true) + @Parameter( property = "project", required = true, readonly = true ) private MavenProject project; /** @@ -73,7 +73,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(defaultValue = "true", required = true, property = "showSuccess") + @Parameter( defaultValue = "true", required = true, property = "showSuccess" ) private boolean showSuccess; /** @@ -85,7 +85,8 @@ public abstract class AbstractSurefireReportMojo private File[] reportsDirectories; /** - * (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format. + * (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and + * rendered to HTML format. * * @noinspection UnusedDeclaration */ @@ -98,7 +99,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection MismatchedQueryAndUpdateOfCollection, UnusedDeclaration */ - @Parameter(property = "reactorProjects", readonly = true) + @Parameter( property = "reactorProjects", readonly = true ) private List<MavenProject> reactorProjects; /** @@ -106,7 +107,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(defaultValue = "${project.reporting.outputDirectory}/xref-test") + @Parameter( defaultValue = "${project.reporting.outputDirectory}/xref-test" ) private File xrefLocation; /** @@ -114,7 +115,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(defaultValue = "true", property = "linkXRef") + @Parameter( defaultValue = "true", property = "linkXRef" ) private boolean linkXRef; /** @@ -122,7 +123,7 @@ public abstract class AbstractSurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(defaultValue = "false", property = "aggregate") + @Parameter( defaultValue = "false", property = "aggregate" ) private boolean aggregate; /** http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java index 81e08e1..071ac44 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java @@ -22,7 +22,6 @@ package org.apache.maven.plugins.surefire.report; import java.io.File; import java.util.Locale; import java.util.ResourceBundle; -import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; @@ -36,7 +35,7 @@ import org.apache.maven.project.MavenProject; * @author Stephen Connolly * @since 2.10 */ -@Mojo(name = "failsafe-report-only") +@Mojo( name = "failsafe-report-only" ) public class FailsafeReportMojo extends AbstractSurefireReportMojo { @@ -46,7 +45,7 @@ public class FailsafeReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(defaultValue = "failsafe-report", property = "outputName", required = true) + @Parameter( defaultValue = "failsafe-report", property = "outputName", required = true ) private String outputName; /** @@ -56,7 +55,7 @@ public class FailsafeReportMojo * @noinspection UnusedDeclaration * @since 2.11 */ - @Parameter(defaultValue = "false", property = "alwaysGenerateFailsafeReport") + @Parameter( defaultValue = "false", property = "alwaysGenerateFailsafeReport" ) private boolean alwaysGenerateFailsafeReport; /** @@ -65,7 +64,7 @@ public class FailsafeReportMojo * @noinspection UnusedDeclaration * @since 2.11 */ - @Parameter(defaultValue = "false", property = "skipFailsafeReport") + @Parameter( defaultValue = "false", property = "skipFailsafeReport" ) private boolean skipFailsafeReport; protected File getSurefireReportsDirectory( MavenProject subProject ) http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java index 68a83b2..77a88c2 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java @@ -308,66 +308,70 @@ public class SurefireReportGenerator { if ( showSuccess || suite.getNumberOfErrors() != 0 || suite.getNumberOfFailures() != 0 ) { + constructTestSuiteSection( sink, numberFormat, suite ); + } + } - sink.tableRow(); + sink.tableRows_(); - sink.tableCell(); + sink.table_(); + } - sink.link( "#" + suite.getPackageName() + suite.getName() ); + sink.section2_(); + } - if ( suite.getNumberOfErrors() > 0 ) - { - sinkIcon( "error", sink ); - } - else if ( suite.getNumberOfFailures() > 0 ) - { - sinkIcon( "junit.framework", sink ); - } - else if ( suite.getNumberOfSkipped() > 0 ) - { - sinkIcon( "skipped", sink ); - } - else - { - sinkIcon( "success", sink ); - } + sinkLineBreak( sink ); - sink.link_(); + sink.section1_(); + } - sink.tableCell_(); + private void constructTestSuiteSection( Sink sink, NumberFormat numberFormat, ReportTestSuite suite ) + { + sink.tableRow(); - sinkCellLink( sink, suite.getName(), "#" + suite.getPackageName() + suite.getName() ); + sink.tableCell(); - sinkCell( sink, Integer.toString( suite.getNumberOfTests() ) ); + sink.link( "#" + suite.getPackageName() + suite.getName() ); - sinkCell( sink, Integer.toString( suite.getNumberOfErrors() ) ); + if ( suite.getNumberOfErrors() > 0 ) + { + sinkIcon( "error", sink ); + } + else if ( suite.getNumberOfFailures() > 0 ) + { + sinkIcon( "junit.framework", sink ); + } + else if ( suite.getNumberOfSkipped() > 0 ) + { + sinkIcon( "skipped", sink ); + } + else + { + sinkIcon( "success", sink ); + } - sinkCell( sink, Integer.toString( suite.getNumberOfFailures() ) ); + sink.link_(); - sinkCell( sink, Integer.toString( suite.getNumberOfSkipped() ) ); + sink.tableCell_(); - String percentage = - report.computePercentage( suite.getNumberOfTests(), suite.getNumberOfErrors(), - suite.getNumberOfFailures(), suite.getNumberOfSkipped() ); - sinkCell( sink, percentage + "%" ); + sinkCellLink( sink, suite.getName(), "#" + suite.getPackageName() + suite.getName() ); - sinkCell( sink, numberFormat.format( suite.getTimeElapsed() ) ); + sinkCell( sink, Integer.toString( suite.getNumberOfTests() ) ); - sink.tableRow_(); - } - } + sinkCell( sink, Integer.toString( suite.getNumberOfErrors() ) ); - sink.tableRows_(); + sinkCell( sink, Integer.toString( suite.getNumberOfFailures() ) ); - sink.table_(); - } + sinkCell( sink, Integer.toString( suite.getNumberOfSkipped() ) ); - sink.section2_(); - } + String percentage = + report.computePercentage( suite.getNumberOfTests(), suite.getNumberOfErrors(), + suite.getNumberOfFailures(), suite.getNumberOfSkipped() ); + sinkCell( sink, percentage + "%" ); - sinkLineBreak( sink ); + sinkCell( sink, numberFormat.format( suite.getTimeElapsed() ) ); - sink.section1_(); + sink.tableRow_(); } private void constructTestCasesSection( ResourceBundle bundle, Sink sink ) @@ -418,130 +422,135 @@ public class SurefireReportGenerator { if ( testCase.getFailure() != null || showSuccess ) { - sink.tableRow(); + constructTestCaseSection( sink, numberFormat, testCase ); + } + } - sink.tableCell(); + sink.tableRows_(); - Map<String, Object> failure = testCase.getFailure(); + sink.table_(); + } - if ( failure != null ) - { - sink.link( "#" + toHtmlId( testCase.getFullName() ) ); + sink.section2_(); + } + } - sinkIcon( (String) failure.get( "type" ), sink ); + sinkLineBreak( sink ); - sink.link_(); - } - else - { - sinkIcon( "success", sink ); - } + sink.section1_(); + } - sink.tableCell_(); + private void constructTestCaseSection( Sink sink, NumberFormat numberFormat, ReportTestCase testCase ) + { + sink.tableRow(); - if ( failure != null ) - { - sink.tableCell(); + sink.tableCell(); - sinkLink( sink, testCase.getName(), "#" + toHtmlId( testCase.getFullName() ) ); + Map<String, Object> failure = testCase.getFailure(); - SinkEventAttributeSet atts = new SinkEventAttributeSet(); - atts.addAttribute( SinkEventAttributes.CLASS, "detailToggle" ); - atts.addAttribute( SinkEventAttributes.STYLE, "display:inline" ); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + if ( failure != null ) + { + sink.link( "#" + toHtmlId( testCase.getFullName() ) ); - sink.link( "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" ); + sinkIcon( (String) failure.get( "type" ), sink ); - atts = new SinkEventAttributeSet(); - atts.addAttribute( SinkEventAttributes.STYLE, "display:inline;" ); - atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "off" ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); - sink.text( " + " ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.link_(); + } + else + { + sinkIcon( "success", sink ); + } - atts = new SinkEventAttributeSet(); - atts.addAttribute( SinkEventAttributes.STYLE, "display:none;" ); - atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "on" ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); - sink.text( " - " ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.tableCell_(); - sink.text( "[ Detail ]" ); - sink.link_(); + if ( failure != null ) + { + sink.tableCell(); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sinkLink( sink, testCase.getName(), "#" + toHtmlId( testCase.getFullName() ) ); - sink.tableCell_(); - } - else - { - sinkCell( sink, testCase.getName() ); - } + SinkEventAttributeSet atts = new SinkEventAttributeSet(); + atts.addAttribute( SinkEventAttributes.CLASS, "detailToggle" ); + atts.addAttribute( SinkEventAttributes.STYLE, "display:inline" ); + sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); - sinkCell( sink, numberFormat.format( testCase.getTime() ) ); + sink.link( "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" ); - sink.tableRow_(); + atts = new SinkEventAttributeSet(); + atts.addAttribute( SinkEventAttributes.STYLE, "display:inline;" ); + atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "off" ); + sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.text( " + " ); + sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); - if ( failure != null ) - { - sink.tableRow(); + atts = new SinkEventAttributeSet(); + atts.addAttribute( SinkEventAttributes.STYLE, "display:none;" ); + atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "on" ); + sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.text( " - " ); + sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); - sinkCell( sink, "" ); - sinkCell( sink, (String) failure.get( "message" ) ); - sinkCell( sink, "" ); - sink.tableRow_(); + sink.text( "[ Detail ]" ); + sink.link_(); - List<String> detail = (List<String>) failure.get( "detail" ); - if ( detail != null ) - { + sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); - sink.tableRow(); - sinkCell( sink, "" ); + sink.tableCell_(); + } + else + { + sinkCell( sink, testCase.getName() ); + } - sink.tableCell(); - SinkEventAttributeSet atts = new SinkEventAttributeSet(); - atts.addAttribute( SinkEventAttributes.ID, - toHtmlId( testCase.getFullName() ) + "error" ); - atts.addAttribute( SinkEventAttributes.STYLE, "display:none;" ); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sinkCell( sink, numberFormat.format( testCase.getTime() ) ); - sink.verbatim( null ); - for ( String line : detail ) - { - sink.text( line ); - sink.lineBreak(); - } - sink.verbatim_(); + sink.tableRow_(); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); - sink.tableCell_(); + if ( failure != null ) + { + sink.tableRow(); - sinkCell( sink, "" ); + sinkCell( sink, "" ); + sinkCell( sink, (String) failure.get( "message" ) ); + sinkCell( sink, "" ); + sink.tableRow_(); - sink.tableRow_(); - } - } - } - } + List<String> detail = (List<String>) failure.get( "detail" ); + if ( detail != null ) + { - sink.tableRows_(); + sink.tableRow(); + sinkCell( sink, "" ); - sink.table_(); + sink.tableCell(); + SinkEventAttributeSet atts = new SinkEventAttributeSet(); + atts.addAttribute( SinkEventAttributes.ID, + toHtmlId( testCase.getFullName() ) + "error" ); + atts.addAttribute( SinkEventAttributes.STYLE, "display:none;" ); + sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + + sink.verbatim( null ); + for ( String line : detail ) + { + sink.text( line ); + sink.lineBreak(); } + sink.verbatim_(); - sink.section2_(); - } - } + sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.tableCell_(); - sinkLineBreak( sink ); + sinkCell( sink, "" ); - sink.section1_(); + sink.tableRow_(); + } + } } private String toHtmlId( String id ) { - if ( DoxiaUtils.isValidId(id) ) + if ( DoxiaUtils.isValidId( id ) ) { return id; } @@ -642,8 +651,8 @@ public class SurefireReportGenerator { String path = tCase.getFullClassName().replace( '.', '/' ); - sink.link( xrefLocation + "/" + path + ".html#" + - getErrorLineNumber( tCase.getFullName(), techMessage ) ); + sink.link( xrefLocation + "/" + path + ".html#" + + getErrorLineNumber( tCase.getFullName(), techMessage ) ); } sink.text( tCase.getFullClassName() + ":" + getErrorLineNumber( tCase.getFullName(), techMessage ) ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java index 2bc9b33..964c1c4 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java @@ -32,8 +32,8 @@ import org.apache.maven.project.MavenProject; * * @author <a href="mailto:jr...@exist.com">Johnny R. Ruiz III</a> */ -@Mojo(name = "report", inheritByDefault = false) -@Execute(lifecycle = "surefire", phase = LifecyclePhase.TEST) +@Mojo( name = "report", inheritByDefault = false ) +@Execute( lifecycle = "surefire", phase = LifecyclePhase.TEST ) public class SurefireReportMojo extends AbstractSurefireReportMojo { @@ -43,7 +43,7 @@ public class SurefireReportMojo * * @noinspection UnusedDeclaration */ - @Parameter(defaultValue = "surefire-report", property = "outputName", required = true) + @Parameter( defaultValue = "surefire-report", property = "outputName", required = true ) private String outputName; /** @@ -53,7 +53,7 @@ public class SurefireReportMojo * @noinspection UnusedDeclaration * @since 2.11 */ - @Parameter(defaultValue = "true", property = "alwaysGenerateSurefireReport") + @Parameter( defaultValue = "true", property = "alwaysGenerateSurefireReport" ) private boolean alwaysGenerateSurefireReport; /** @@ -62,7 +62,7 @@ public class SurefireReportMojo * @noinspection UnusedDeclaration * @since 2.11 */ - @Parameter(defaultValue = "false", property = "skipSurefireReport") + @Parameter( defaultValue = "false", property = "skipSurefireReport" ) private boolean skipSurefireReport; protected File getSurefireReportsDirectory( MavenProject subProject ) http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java index 0b1fc59..9409498 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java @@ -32,8 +32,8 @@ import org.apache.maven.plugins.annotations.Mojo; * @author <a href="mailto:baerr...@gmail.com">Barrie Treloar</a> * @since 2.3 */ -@Mojo(name = "report-only") -@Execute(phase = LifecyclePhase.NONE) +@Mojo( name = "report-only" ) +@Execute( phase = LifecyclePhase.NONE ) public class SurefireReportOnlyMojo extends SurefireReportMojo { http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index ef0e009..12ee4b3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>maven-parent</artifactId> <groupId>org.apache.maven</groupId> - <version>24</version> + <version>25</version> <relativePath>../pom/maven/pom.xml</relativePath> </parent> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java index 73d2adf..7722943 100644 --- a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java +++ b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatistics.java @@ -1,4 +1,5 @@ package org.apache.maven.plugin.surefire.runorder; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java index 6519ff6..7e77625 100644 --- a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java +++ b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/ThreadedExecutionScheduler.java @@ -1,4 +1,5 @@ package org.apache.maven.plugin.surefire.runorder; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/SpecificTestClassFilter.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/SpecificTestClassFilter.java b/surefire-api/src/main/java/org/apache/maven/surefire/SpecificTestClassFilter.java index 6288e8a..ca98b8c 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/SpecificTestClassFilter.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/SpecificTestClassFilter.java @@ -1,4 +1,5 @@ package org.apache.maven.surefire; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -24,6 +25,10 @@ import java.util.Set; import org.apache.maven.shared.utils.io.SelectorUtils; import org.apache.maven.surefire.util.ScannerFilter; +/** + * Filter for test class files + * + */ public class SpecificTestClassFilter implements ScannerFilter { http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java index dee42aa..92cab09 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/BaseProviderFactory.java @@ -58,7 +58,7 @@ public class BaseProviderFactory private TestArtifactInfo testArtifactInfo; - private static final Integer ROOT_CHANNEl = 0; + private static final Integer ROOT_CHANNEL = 0; private final ReporterFactory reporterFactory; @@ -128,7 +128,7 @@ public class BaseProviderFactory { if ( insideFork ) { - return new ForkingRunListener( reporterConfiguration.getOriginalSystemOut(), ROOT_CHANNEl, + return new ForkingRunListener( reporterConfiguration.getOriginalSystemOut(), ROOT_CHANNEL, reporterConfiguration.isTrimStackTrace() ); } return new DefaultDirectConsoleReporter( reporterConfiguration.getOriginalSystemOut() ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java index 0af1e29..a4f4dc1 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java @@ -193,7 +193,7 @@ public class ForkingRunListener int mask = radix - 1; do { - header[--charPos] = (byte) digits[i & mask]; + header[--charPos] = (byte) DIGITS[i & mask]; i >>>= 4; } while ( i != 0 ); @@ -205,7 +205,7 @@ public class ForkingRunListener return header; } - private final static char[] digits = + private static final char[] DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; @@ -218,8 +218,8 @@ public class ForkingRunListener } StringBuilder sb = new StringBuilder( 7 + message.length() * 5 ); - append( sb, BOOTERCODE_CONSOLE );comma( sb ); - append( sb, Integer.toHexString( testSetChannelId ) );comma( sb ); + append( sb, BOOTERCODE_CONSOLE ); comma( sb ); + append( sb, Integer.toHexString( testSetChannelId ) ); comma( sb ); StringUtils.escapeToPrintable( sb, message ); sb.append( '\n' ); @@ -230,8 +230,8 @@ public class ForkingRunListener { StringBuilder stringBuilder = new StringBuilder(); - append( stringBuilder, BOOTERCODE_SYSPROPS );comma( stringBuilder ); - append( stringBuilder, Integer.toHexString( testSetChannelId ) );comma( stringBuilder ); + append( stringBuilder, BOOTERCODE_SYSPROPS ); comma( stringBuilder ); + append( stringBuilder, Integer.toHexString( testSetChannelId ) ); comma( stringBuilder ); StringUtils.escapeToPrintable( stringBuilder, key ); comma( stringBuilder ); @@ -244,7 +244,7 @@ public class ForkingRunListener { StringBuilder stringBuilder = new StringBuilder(); append( stringBuilder, operationCode ); comma( stringBuilder ); - append( stringBuilder, Integer.toHexString( testSetChannelId ) );comma( stringBuilder ); + append( stringBuilder, Integer.toHexString( testSetChannelId ) ); comma( stringBuilder ); nullableEncoding( stringBuilder, reportEntry.getSourceName() ); comma( stringBuilder ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/booter/ProviderParameterNames.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ProviderParameterNames.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ProviderParameterNames.java index d9e1377..59bddf6 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ProviderParameterNames.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ProviderParameterNames.java @@ -1,4 +1,5 @@ package org.apache.maven.surefire.booter; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java index 2e4bee4..da7cbc3 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java @@ -154,9 +154,9 @@ public class SurefireReflector } Class[] arguments = { List.class, File.class, String.class, String.class, int.class }; Constructor constructor = ReflectionUtils.getConstructor( this.testRequest, arguments ); - return ReflectionUtils.newInstance(constructor, new Object[]{ suiteDefinition.getSuiteXmlFiles(), + return ReflectionUtils.newInstance( constructor, new Object[]{ suiteDefinition.getSuiteXmlFiles(), suiteDefinition.getTestSourceDirectory(), suiteDefinition.getRequestedTest(), - suiteDefinition.getRequestedTestMethod(), suiteDefinition.getRerunFailingTestsCount() }); + suiteDefinition.getRequestedTestMethod(), suiteDefinition.getRerunFailingTestsCount() } ); } @@ -217,7 +217,8 @@ public class SurefireReflector reporterConfiguration.isTrimStackTrace() } ); } - public static ReporterFactory createForkingReporterFactoryInCurrentClassLoader( Boolean trimStackTrace, PrintStream originalSystemOut ) + public static ReporterFactory createForkingReporterFactoryInCurrentClassLoader( Boolean trimStackTrace, + PrintStream originalSystemOut ) { return new ForkingReporterFactory( trimStackTrace, originalSystemOut ); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/SurefireProvider.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/SurefireProvider.java b/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/SurefireProvider.java index bdc543c..46c541b 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/SurefireProvider.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/SurefireProvider.java @@ -66,7 +66,7 @@ public interface SurefireProvider * @throws org.apache.maven.surefire.testset.TestSetFailedException * When testset fails */ - + @SuppressWarnings( "checkstyle:redundantthrows" ) RunResult invoke( Object forkTestSet ) throws TestSetFailedException, ReporterException, InvocationTargetException; http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleLogger.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleLogger.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleLogger.java index 4a2e969..4382428 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleLogger.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleLogger.java @@ -29,5 +29,5 @@ package org.apache.maven.surefire.report; */ public interface ConsoleLogger { - public void info( String message ); + void info( String message ); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java index dd1d665..7421703 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java @@ -78,7 +78,7 @@ public class ConsoleOutputCapture } } - static final byte[] newline = new byte[]{ (byte) '\n' }; + static final byte[] NL = new byte[]{ (byte) '\n' }; public void println( String s ) { @@ -87,7 +87,7 @@ public class ConsoleOutputCapture s = "null"; // Shamelessly taken from super.print } final byte[] bytes = s.getBytes(); - final byte[] join = ByteBuffer.join( bytes, 0, bytes.length, newline, 0, 1 ); + final byte[] join = ByteBuffer.join( bytes, 0, bytes.length, NL, 0, 1 ); target.writeTestOutput( join, 0, join.length, isStdout ); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java index fb0152c..836a499 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputReceiverForCurrentThread.java @@ -24,7 +24,8 @@ package org.apache.maven.surefire.report; */ public final class ConsoleOutputReceiverForCurrentThread { - private static final ThreadLocal<ConsoleOutputReceiver> current = new InheritableThreadLocal<ConsoleOutputReceiver>(); + private static final ThreadLocal<ConsoleOutputReceiver> CURRENT + = new InheritableThreadLocal<ConsoleOutputReceiver>(); private ConsoleOutputReceiverForCurrentThread() { @@ -32,17 +33,17 @@ public final class ConsoleOutputReceiverForCurrentThread public static ConsoleOutputReceiver get() { - return current.get(); + return CURRENT.get(); } public static void set( ConsoleOutputReceiver consoleOutputReceiver ) { - current.set( consoleOutputReceiver ); + CURRENT.set( consoleOutputReceiver ); } public static void remove() { - current.remove(); + CURRENT.remove(); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultDirectConsoleReporter.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultDirectConsoleReporter.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultDirectConsoleReporter.java index caee844..f9273ba 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultDirectConsoleReporter.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/DefaultDirectConsoleReporter.java @@ -1,4 +1,5 @@ package org.apache.maven.surefire.report; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java index 3f6a352..aaa7f5a 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/LegacyPojoStackTraceWriter.java @@ -33,6 +33,8 @@ import org.apache.maven.surefire.util.internal.StringUtils; public class LegacyPojoStackTraceWriter implements StackTraceWriter { + private static final int MAX_LINE_LENGTH = 77; + private final Throwable t; private final String testClass; @@ -67,7 +69,7 @@ public class LegacyPojoStackTraceWriter if ( throwable.getTarget() instanceof AssertionError ) { result.append( " " ); - result.append( getTruncatedMessage( throwable.getMessage(), 77 - result.length() ) ); + result.append( getTruncatedMessage( throwable.getMessage(), MAX_LINE_LENGTH - result.length() ) ); } else { @@ -76,7 +78,7 @@ public class LegacyPojoStackTraceWriter { result.append( " " ); result.append( target.getClass().getSimpleName() ); - result.append( getTruncatedMessage( throwable.getMessage(), 77 - result.length() ) ); + result.append( getTruncatedMessage( throwable.getMessage(), MAX_LINE_LENGTH - result.length() ) ); } } return result.toString(); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java index 65bcb56..2bc3fcd 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java @@ -19,6 +19,10 @@ package org.apache.maven.surefire.report; * under the License. */ +/** + * Describes a single entry for a test report + * + */ public interface ReportEntry { /** @@ -26,35 +30,35 @@ public interface ReportEntry * * @return A string with the class name */ - public String getSourceName(); + String getSourceName(); /** * The name of the test case * * @return A string describing the test case */ - public String getName(); + String getName(); /** * The group/category of the testcase * * @return A string */ - public String getGroup(); + String getGroup(); /** * The group/category of the testcase * * @return A string */ - public StackTraceWriter getStackTraceWriter(); + StackTraceWriter getStackTraceWriter(); /** * Gets the runtime for the item. Optional parameter. If the value is not set, it will be determined within * the reporting subsustem. Some providers like to calculate this value themselves, and it gets the * most accurate value. */ - public Integer getElapsed(); + Integer getElapsed(); /** @@ -63,12 +67,12 @@ public interface ReportEntry * * @return A string that explains an anomaly */ - public String getMessage(); + String getMessage(); /** * A name of the test case together with the group or category (if any exists). * * @return A string with the test case name and group/category, or just the name. */ - public String getNameWithGroup(); + String getNameWithGroup(); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java index 1d8d0af..60c7897 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/SafeThrowable.java @@ -1,4 +1,5 @@ package org.apache.maven.surefire.report; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java index 57f3f33..9c096f1 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/testset/RunOrderParameters.java @@ -43,7 +43,7 @@ public class RunOrderParameters this.runStatisticsFile = runStatisticsFile != null ? new File( runStatisticsFile ) : null; } - public static RunOrderParameters ALPHABETICAL() + public static RunOrderParameters alphabetical() { return new RunOrderParameters( new RunOrder[]{ RunOrder.ALPHABETICAL }, null ); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java ---------------------------------------------------------------------- diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java index 147c6e7..6651a27 100644 --- a/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java +++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultRunOrderCalculator.java @@ -52,6 +52,7 @@ public class DefaultRunOrderCalculator this.sortOrder = this.runOrder.length > 0 ? getSortOrderComparator( this.runOrder[0] ) : null; } + @SuppressWarnings( "checkstyle:magicnumber" ) public TestsToRun orderTestClasses( TestsToRun scannedClasses ) { @@ -85,7 +86,8 @@ public class DefaultRunOrderCalculator { RunEntryStatisticsMap runEntryStatisticsMap = RunEntryStatisticsMap.fromFile( runOrderParameters.getRunStatisticsFile() ); - final List<Class> prioritized = runEntryStatisticsMap.getPrioritizedTestsClassRunTime( testClasses, threadCount ); + final List<Class> prioritized = + runEntryStatisticsMap.getPrioritizedTestsClassRunTime( testClasses, threadCount ); testClasses.clear(); testClasses.addAll( prioritized );