You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/11/02 01:54:41 UTC
[maven-surefire] branch 3.0.0-M1-J7 updated (4df9e42 -> d23e970)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch 3.0.0-M1-J7
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
discard 4df9e42 [SUREFIRE-1474] Java 1.7 as minimum
new d23e970 [SUREFIRE-1474] Java 1.7 as minimum
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (4df9e42)
\
N -- N -- N refs/heads/3.0.0-M1-J7 (d23e970)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../surefire/booterclient/ModularClasspathForkConfiguration.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[maven-surefire] 01/01: [SUREFIRE-1474] Java 1.7 as minimum
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch 3.0.0-M1-J7
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit d23e970cd86ce4896edf5f8ad1f1acd66a9a27c2
Author: Tibor17 <ti...@apache.org>
AuthorDate: Thu Nov 1 22:14:51 2018 +0100
[SUREFIRE-1474] Java 1.7 as minimum
---
.../src/it/multiple-summaries-failing/pom.xml | 4 +-
.../src/it/multiple-summaries/pom.xml | 4 +-
.../src/it/working-directory/pom.xml | 4 +-
.../failsafe/util/FailsafeSummaryXmlUtils.java | 23 +--
maven-surefire-common/pom.xml | 10 -
.../plugin/surefire/AbstractSurefireMojo.java | 105 ++--------
.../maven/plugin/surefire/JdkAttributes.java | 2 +-
.../maven/plugin/surefire/SurefireProperties.java | 24 +--
.../surefire/booterclient/ChecksumCalculator.java | 4 +-
.../plugin/surefire/booterclient/ForkStarter.java | 20 +-
.../booterclient/JarManifestForkConfiguration.java | 7 +-
.../ModularClasspathForkConfiguration.java | 16 +-
.../lazytestprovider/AbstractForkInputStream.java | 2 +-
.../surefire/report/ConsoleOutputFileReporter.java | 2 +-
.../surefire/report/DirectConsoleOutput.java | 2 +-
.../maven/plugin/surefire/report/FileReporter.java | 12 +-
.../surefire/report/StatelessXmlReporter.java | 47 ++---
.../Utf8RecodingDeferredFileOutputStream.java | 2 +-
.../plugin/surefire/util/DependencyScanner.java | 17 +-
.../maven/surefire/providerapi/ServiceLoader.java | 30 +--
.../AbstractSurefireMojoJava7PlusTest.java | 50 +----
.../maven/plugin/surefire/MojoMocklessTest.java | 43 +++--
.../TestProvidingInputStreamTest.java | 10 +-
.../surefire/report/StatelessXmlReporterTest.java | 3 +-
.../surefire/util/DependenciesScannerTest.java | 17 +-
.../report/ConsoleOutputFileReporterTest.java | 4 +-
maven-surefire-report-plugin/pom.xml | 1 -
pom.xml | 35 +---
.../surefire/runorder/RunEntryStatisticsMap.java | 28 +--
.../org/apache/maven/surefire/booter/Command.java | 2 +-
.../maven/surefire/booter/CommandReader.java | 11 +-
.../surefire/booter/MasterProcessCommand.java | 6 +-
.../report/LegacyPojoStackTraceWriter.java | 8 +-
.../org/apache/maven/surefire/suite/RunResult.java | 8 +-
.../maven/surefire/util/ReflectionUtils.java | 39 +---
.../surefire/util/internal/DumpFileUtils.java | 32 ++--
.../maven/surefire/util/internal/ObjectUtils.java | 42 +---
.../maven/surefire/util/internal/StringUtils.java | 13 +-
.../maven/surefire/util/internal/UrlUtils.java | 79 --------
.../java/org/apache/maven/JUnit4SuiteTest.java | 2 -
.../apache/maven/surefire/util/UrlUtilsTest.java | 102 ----------
surefire-booter/pom.xml | 10 -
.../apache/maven/surefire/booter/Classpath.java | 28 +--
.../apache/maven/surefire/booter/PpidChecker.java | 2 +-
.../maven/surefire/booter/ProviderFactory.java | 4 +-
.../surefire/booter/SystemPropertyManager.java | 37 +---
.../apache/maven/surefire/booter/SystemUtils.java | 34 +---
.../maven/surefire/booter/TypeEncodedValue.java | 2 +-
.../maven/surefire/booter/ClasspathTest.java | 16 --
.../maven/surefire/booter/CommandReaderTest.java | 17 +-
.../surefire/booter/SurefireReflectorTest.java | 12 +-
.../maven/surefire/its/AbstractJigsawIT.java | 7 +-
.../its/JUnit47RerunFailingTestWithCucumberIT.java | 9 -
.../maven/surefire/its/JUnit47WithCucumberIT.java | 9 -
.../maven/surefire/its/WorkingDirectoryIT.java | 7 +-
.../maven/surefire/its/fixture/TestFile.java | 8 +-
.../jiras/Surefire1177TestngParallelSuitesIT.java | 5 -
.../its/jiras/Surefire1211JUnitTestNgIT.java | 6 -
.../jiras/Surefire260TestWithIdenticalNamesIT.java | 7 +-
.../test/resources/environment-variables/pom.xml | 4 +-
.../src/test/resources/failingBuilds/pom.xml | 4 +-
.../src/test/resources/failsafe-notests/pom.xml | 4 +-
.../test/resources/failure-result-counting/pom.xml | 4 +-
.../src/test/resources/failureOutput/pom.xml | 4 +-
.../src/test/resources/fork-consoleOutput/pom.xml | 4 +-
.../resources/fork-consoleOutputWithErrors/pom.xml | 4 +-
surefire-its/src/test/resources/fork-fail/pom.xml | 4 +-
.../fork-fail/src/test/java/forkMode/Test1.java | 15 +-
.../module-a/src/test/java/forkMode/Test1.java | 22 +--
.../module-b/src/test/java/forkMode/Test1.java | 22 +--
.../test/resources/fork-mode-multimodule/pom.xml | 4 +-
.../resources/fork-mode-resource-loading/pom.xml | 4 +-
.../src/test/resources/fork-mode-testng/pom.xml | 4 +-
.../src/test/java/forkMode/Test1.java | 19 +-
surefire-its/src/test/resources/fork-mode/pom.xml | 4 +-
.../fork-mode/src/test/java/forkMode/Test1.java | 23 ++-
.../src/test/resources/fork-timeout/pom.xml | 4 +-
.../resources/includes-excludes-from-file/pom.xml | 4 +-
.../src/test/java/org/test/DefaultTest.java | 8 +-
.../test/java/org/test/NotIncludedByDefault.java | 8 +-
.../src/test/resources/includes-excludes/pom.xml | 4 +-
.../src/test/java/org/test/DefaultTest.java | 8 +-
.../test/java/org/test/NotIncludedByDefault.java | 8 +-
.../test/resources/isolated-classloader/pom.xml | 4 +-
.../test/resources/junit-fork-mode-always/pom.xml | 4 +-
.../src/test/java/junit4/forkMode/Test1.java | 18 +-
.../src/test/resources/junit-ignore/pom.xml | 4 +-
.../src/test/resources/junit-innerClass/pom.xml | 4 +-
.../resources/junit-notExtendingTestCase/pom.xml | 4 +-
.../test/resources/junit-pathWithUmlaut/pom.xml | 4 +-
.../test/resources/junit-twoTestCaseSuite/pom.xml | 4 +-
.../src/test/resources/junit-twoTestCases/pom.xml | 4 +-
.../resources/junit4-forkAlways-staticInit/pom.xml | 4 +-
.../resources/junit4-rerun-failing-tests/pom.xml | 4 +-
.../src/test/resources/junit4-runlistener/pom.xml | 4 +-
.../src/test/java/runListener/FileHelper.java | 8 +-
.../test/resources/junit4-twoTestCaseSuite/pom.xml | 4 +-
.../src/test/resources/junit44-dep/pom.xml | 4 +-
.../src/test/resources/junit44-environment/pom.xml | 4 +-
.../src/test/resources/junit44-hamcrest/pom.xml | 4 +-
.../test/resources/junit44-method-pattern/pom.xml | 4 +-
.../test/resources/junit44-single-method/pom.xml | 4 +-
.../resources/junit47-parallel-with-suite/pom.xml | 4 +-
.../test/resources/junit47-redirect-output/pom.xml | 4 +-
.../junit47-static-inner-class-tests/pom.xml | 4 +-
.../src/test/resources/junit48-categories/pom.xml | 4 +-
.../test/resources/junit48-smartStackTrace/pom.xml | 4 +-
.../src/test/resources/norunnableTests/pom.xml | 4 +-
.../src/test/resources/parallel-runtime/pom.xml | 4 +-
.../resources/plain-old-java-classpath/pom.xml | 4 +-
.../src/test/resources/plexus-conflict/pom.xml | 4 +-
.../src/test/resources/pojo-simple/pom.xml | 4 +-
surefire-its/src/test/resources/pom.xml | 4 +-
surefire-its/src/test/resources/reporters/pom.xml | 4 +-
.../src/test/resources/result-counting/pom.xml | 4 +-
surefire-its/src/test/resources/runOrder/pom.xml | 4 +-
.../src/test/resources/runorder-parallel/pom.xml | 4 +-
.../sibling-aggregator/aggregator/pom.xml | 4 +-
.../resources/sibling-aggregator/child1/pom.xml | 4 +-
.../resources/sibling-aggregator/child2/pom.xml | 4 +-
.../test/resources/small-result-counting/pom.xml | 4 +-
.../jiras-surefire-1024-testjar/pom.xml | 4 +-
.../pom.xml | 4 +-
.../pom.xml | 4 +-
.../surefire-1122-parallel-and-flakyTests/pom.xml | 4 +-
.../pom.xml | 4 +-
.../surefire-1202-rerun-and-failfast/pom.xml | 4 +-
.../surefire-1209-rerun-and-forkcount/pom.xml | 4 +-
.../surefire-1278-group-name-ending/pom.xml | 4 +-
.../pom.xml | 4 +-
.../pom.xml | 4 +-
.../pom.xml | 4 +-
.../surefire-141-pluggableproviders/pom.xml | 4 +-
.../surefire-146-forkPerTestNoSetup/pom.xml | 4 +-
.../surefire-1535-parallel-testng/pom.xml | 4 +-
.../resources/surefire-162-charsetProvider/pom.xml | 4 +-
.../surefire-224-wellFormedXmlFailures/pom.xml | 4 +-
.../resources/surefire-257-rerunningTests/pom.xml | 4 +-
.../surefire-260-testWithIdenticalNames/pom.xml | 4 +-
.../surefire-34-securityManager-success/pom.xml | 4 +-
.../resources/surefire-34-securityManager/pom.xml | 4 +-
.../surefire-408-manual-provider-selection/pom.xml | 4 +-
.../resources/surefire-500-puzzling-error/pom.xml | 4 +-
.../resources/surefire-510-testClassPath/pom.xml | 4 +-
.../surefire-570-multipleReportDirectories/pom.xml | 4 +-
.../surefire-613-testCount-in-parallel/pom.xml | 4 +-
.../pom.xml | 4 +-
.../pom.xml | 4 +-
.../surefire-634-systemPropertiesWarning/pom.xml | 4 +-
.../test/resources/surefire-673-mockito/pom.xml | 4 +-
.../surefire-674-buildFailingWhenErrors/pom.xml | 4 +-
.../surefire-685-commaseparatedIncludes/pom.xml | 4 +-
.../resources/surefire-697-niceSummary/pom.xml | 4 +-
.../surefire-733-allOverridesCaptured/pom.xml | 4 +-
.../pom.xml | 4 +-
.../apache/maven/surefire/test/FailingTest.java | 18 +-
.../apache/maven/surefire/test/SucceedingTest.java | 19 +-
.../pom.xml | 4 +-
.../surefire-806-specifiedTests-multi/pom.xml | 4 +-
.../surefire-806-specifiedTests-single/pom.xml | 4 +-
.../surefire-809-groupExpr-junit48/pom.xml | 4 +-
.../surefire-809-groupExpr-testng/pom.xml | 4 +-
.../surefire-812-log4j-classloader/pom.xml | 4 +-
.../surefire-818-ignored-tests-on-npe/pom.xml | 4 +-
.../surefire-828-emptyGroupExpr-junit48/pom.xml | 4 +-
.../surefire-828-emptyGroupExpr-testng/pom.xml | 4 +-
.../surefire-832-provider-selection/pom.xml | 4 +-
.../test/resources/surefire-847-testngfail/pom.xml | 4 +-
.../test/java/jiras/surefre855/bundle/FooIT.java | 18 +-
.../src/test/java/jiras/surefire855/jar/FooIT.java | 18 +-
.../src/test/java/jiras/surefire855/war/FooIT.java | 18 +-
.../surefire-930-failsafe-runtests/pom.xml | 4 +-
.../surefire-931-provider-failure/pom.xml | 4 +-
.../resources/surefire-943-report-content/pom.xml | 4 +-
.../pom.xml | 4 +-
.../surefire-946-self-destruct-plugin/pom.xml | 4 +-
.../surefire-972-bizarre-noclassdef/pom.xml | 4 +-
.../resources/surefire-975-wrong-encoding/pom.xml | 4 +-
.../module1/pom.xml | 4 +-
.../module2/pom.xml | 4 +-
.../pom.xml | 4 +-
.../src/test/resources/system-properties/pom.xml | 4 +-
.../resources/test-helper-dump-pid-plugin/pom.xml | 4 +-
.../plugins/surefire/dumppid/DumpPidMojo.java | 17 +-
.../resources/testng-afterSuiteFailure/pom.xml | 4 +-
.../src/test/resources/testng-beforeMethod/pom.xml | 4 +-
.../resources/testng-beforeMethodFailure/pom.xml | 4 +-
.../test/resources/testng-execute-error/pom.xml | 4 +-
.../src/test/resources/testng-groups/pom.xml | 4 +-
.../src/test/resources/testng-jdk14/pom.xml | 4 +-
.../test/resources/testng-junit-together/pom.xml | 4 +-
.../resources/testng-listener-reporter/pom.xml | 4 +-
.../src/test/java/listenReport/FileHelper.java | 10 +-
.../resources/testng-method-pattern-after/pom.xml | 4 +-
.../resources/testng-method-pattern-before/pom.xml | 4 +-
.../test/resources/testng-method-pattern/pom.xml | 4 +-
.../test/java/testng/objectfactory/FileHelper.java | 14 +-
.../testng-parallel-with-annotations/pom.xml | 4 +-
.../test/resources/testng-path with spaces/pom.xml | 4 +-
.../src/test/resources/testng-simple/pom.xml | 4 +-
.../resources/testng-single-method-5-14-9/pom.xml | 4 +-
.../test/resources/testng-single-method/pom.xml | 4 +-
.../src/test/resources/testng-suite-xml/pom.xml | 4 +-
.../java/testng/testrunnerfactory/FileHelper.java | 14 +-
.../test/resources/testng-twoTestCaseSuite/pom.xml | 4 +-
.../src/test/resources/timeout-forked/pom.xml | 4 +-
.../src/test/resources/unicode-testnames/pom.xml | 4 +-
.../working-directory-is-invalid-property/pom.xml | 4 +-
.../resources/working-directory-missing/pom.xml | 4 +-
.../child/src/test/java/workingDir/BasicTest.java | 15 +-
.../src/test/resources/working-directory/pom.xml | 4 +-
.../surefire/log/api/ConsoleLoggerUtils.java | 8 +-
.../surefire/report/PojoStackTraceWriter.java | 8 +-
.../surefire/common/junit3/JUnit3Reflector.java | 14 +-
.../surefire/common/junit4/JUnit4Reflector.java | 50 +----
.../apache/maven/surefire/junit/JUnitTestSet.java | 19 +-
.../apache/maven/surefire/junit/PojoTestSet.java | 9 +-
.../junit/TestListenerInvocationHandler.java | 37 ++--
.../maven/surefire/junit/JUnitTestSetTest.java | 5 +-
.../maven/surefire/junitcore/pc/Scheduler.java | 13 +-
.../surefire/junitcore/pc/SchedulingStrategy.java | 8 +-
.../maven/surefire/testng/TestNGExecutor.java | 16 +-
.../testng/conf/TestNGMapConfigurator.java | 82 +++-----
.../surefire/report/TestSuiteXmlParser.java | 213 ++++++++++-----------
224 files changed, 785 insertions(+), 1633 deletions(-)
diff --git a/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml b/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
index aedbdde..af2df65 100644
--- a/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
+++ b/maven-failsafe-plugin/src/it/multiple-summaries-failing/pom.xml
@@ -27,8 +27,8 @@
<name>Run tests multiple times</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml b/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
index d87409f..2c508f3 100644
--- a/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
+++ b/maven-failsafe-plugin/src/it/multiple-summaries/pom.xml
@@ -27,8 +27,8 @@
<name>Run tests multiple times</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/maven-failsafe-plugin/src/it/working-directory/pom.xml b/maven-failsafe-plugin/src/it/working-directory/pom.xml
index 6cf2bc5..22d5034 100644
--- a/maven-failsafe-plugin/src/it/working-directory/pom.xml
+++ b/maven-failsafe-plugin/src/it/working-directory/pom.xml
@@ -27,8 +27,8 @@
<name>Run tests in a nonexistent working directory</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java
index 2e033f1..6035308 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java
@@ -36,9 +36,9 @@ import java.util.Locale;
import static java.lang.Boolean.parseBoolean;
import static java.lang.Integer.parseInt;
import static java.lang.String.format;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.lang3.StringEscapeUtils.escapeXml10;
import static org.apache.commons.lang3.StringEscapeUtils.unescapeXml;
-import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
/**
@@ -78,11 +78,9 @@ public final class FailsafeSummaryXmlUtils
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();
- FileInputStream is = new FileInputStream( failsafeSummaryXml );
-
- try
+ try ( FileInputStream is = new FileInputStream( failsafeSummaryXml ) )
{
- Node root = (Node) xpath.evaluate( "/", new InputSource( is ), XPathConstants.NODE );
+ Node root = ( Node ) xpath.evaluate( "/", new InputSource( is ), XPathConstants.NODE );
String completed = xpath.evaluate( "/failsafe-summary/completed", root );
String errors = xpath.evaluate( "/failsafe-summary/errors", root );
@@ -92,14 +90,10 @@ public final class FailsafeSummaryXmlUtils
String timeout = xpath.evaluate( "/failsafe-summary/@timeout", root );
return new RunResult( parseInt( completed ), parseInt( errors ), parseInt( failures ), parseInt( skipped ),
- isBlank( failureMessage ) ? null : unescapeXml( failureMessage ),
- parseBoolean( timeout )
+ isBlank( failureMessage ) ? null : unescapeXml( failureMessage ),
+ parseBoolean( timeout )
);
}
- finally
- {
- is.close();
- }
}
public static void fromRunResultToFile( RunResult fromRunResult, File toFailsafeSummaryXml )
@@ -116,15 +110,10 @@ public final class FailsafeSummaryXmlUtils
fromRunResult.getSkipped(),
msg );
- FileOutputStream os = new FileOutputStream( toFailsafeSummaryXml );
- try
+ try ( FileOutputStream os = new FileOutputStream( toFailsafeSummaryXml ) )
{
IOUtils.write( xml, os, UTF_8 );
}
- finally
- {
- os.close();
- }
}
public static void writeSummary( RunResult mergedSummary, File mergedSummaryFile, boolean inProgress )
diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml
index c78c5a1..f5f9a3d 100644
--- a/maven-surefire-common/pom.xml
+++ b/maven-surefire-common/pom.xml
@@ -127,16 +127,6 @@
<artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy-agent</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 7bdde2a..e07968d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -76,7 +76,6 @@ import org.apache.maven.surefire.testset.TestRequest;
import org.apache.maven.surefire.testset.TestSetFailedException;
import org.apache.maven.surefire.util.DefaultScanResult;
import org.apache.maven.surefire.util.RunOrder;
-import org.apache.maven.surefire.util.SurefireReflectionException;
import org.apache.maven.toolchain.DefaultToolchain;
import org.apache.maven.toolchain.Toolchain;
import org.apache.maven.toolchain.ToolchainManager;
@@ -88,8 +87,8 @@ import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
-import java.lang.reflect.Array;
import java.math.BigDecimal;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
@@ -122,16 +121,12 @@ import static org.apache.maven.shared.utils.StringUtils.isNotEmpty;
import static org.apache.maven.shared.utils.StringUtils.split;
import static org.apache.maven.surefire.booter.SystemUtils.JAVA_SPECIFICATION_VERSION;
import static org.apache.maven.surefire.booter.SystemUtils.endsWithJavaPath;
-import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava7AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava9AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.isJava9AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.toJdkHomeFromJvmExec;
import static org.apache.maven.surefire.booter.SystemUtils.toJdkVersionFromReleaseFile;
import static org.apache.maven.surefire.suite.RunResult.failure;
import static org.apache.maven.surefire.suite.RunResult.noTestsRun;
-import static org.apache.maven.surefire.util.ReflectionUtils.invokeGetter;
-import static org.apache.maven.surefire.util.ReflectionUtils.invokeStaticMethod;
-import static org.apache.maven.surefire.util.ReflectionUtils.tryLoadClass;
/**
* Abstract base class for running tests using Surefire.
@@ -150,7 +145,6 @@ public abstract class AbstractSurefireMojo
private static final Map<String, String> JAVA_9_MATCHER_OLD_NOTATION = singletonMap( "version", "[1.9,)" );
private static final Map<String, String> JAVA_9_MATCHER = singletonMap( "version", "[9,)" );
private static final Platform PLATFORM = new Platform();
- private static final File SYSTEM_TMP_DIR = new File( System.getProperty( "java.io.tmpdir" ) );
private final ProviderDetector providerDetector = new ProviderDetector();
@@ -995,21 +989,7 @@ public abstract class AbstractSurefireMojo
{
current = current.aggregate( executeProvider( provider, scanResult ) );
}
- catch ( SurefireBooterForkException e )
- {
- if ( firstForkException == null )
- {
- firstForkException = e;
- }
- }
- catch ( SurefireExecutionException e )
- {
- if ( firstForkException == null )
- {
- firstForkException = e;
- }
- }
- catch ( TestSetFailedException e )
+ catch ( SurefireBooterForkException | SurefireExecutionException | TestSetFailedException e )
{
if ( firstForkException == null )
{
@@ -1105,7 +1085,7 @@ public abstract class AbstractSurefireMojo
private Set<Object> systemPropertiesMatchingArgLine( SurefireProperties result )
{
- Set<Object> intersection = new HashSet<Object>();
+ Set<Object> intersection = new HashSet<>();
if ( isNotBlank( getArgLine() ) )
{
for ( Object systemProperty : result.getStringKeySet() )
@@ -1167,12 +1147,6 @@ public abstract class AbstractSurefireMojo
return forkStarter.run( effectiveProperties, scanResult );
}
- // tod Java 1.7 multiple exception catch block
- catch ( SurefireExecutionException e )
- {
- forkStarter.killOrphanForks();
- throw e;
- }
catch ( SurefireBooterForkException e )
{
forkStarter.killOrphanForks();
@@ -1768,7 +1742,7 @@ public abstract class AbstractSurefireMojo
private static Set<Artifact> retainInProcArtifactsUnique( Set<Artifact> providerArtifacts,
Artifact... inPluginArtifacts )
{
- Set<Artifact> result = new LinkedHashSet<Artifact>();
+ Set<Artifact> result = new LinkedHashSet<>();
for ( Artifact inPluginArtifact : inPluginArtifacts )
{
boolean contains = false;
@@ -1828,7 +1802,7 @@ public abstract class AbstractSurefireMojo
testClasspath = new Classpath( result.getClasspathElements() );
Classpath testModulepath = new Classpath( result.getModulepathElements().keySet() );
- SortedSet<String> packages = new TreeSet<String>();
+ SortedSet<String> packages = new TreeSet<>();
for ( String className : scanResult.getClasses() )
{
@@ -1969,7 +1943,7 @@ public abstract class AbstractSurefireMojo
List<String> includes = null;
if ( isSpecificTestSpecified() )
{
- includes = new ArrayList<String>();
+ includes = new ArrayList<>();
addAll( includes, split( getTest(), "," ) );
}
else
@@ -2037,7 +2011,7 @@ public abstract class AbstractSurefireMojo
@Nonnull private List<String> filterNulls( @Nonnull List<String> toFilter )
{
- List<String> result = new ArrayList<String>( toFilter.size() );
+ List<String> result = new ArrayList<>( toFilter.size() );
for ( String item : toFilter )
{
if ( item != null )
@@ -2531,7 +2505,7 @@ public abstract class AbstractSurefireMojo
Classpath existing = ClasspathCache.getCachedClassPath( surefireArtifact.getArtifactId() );
if ( existing == null )
{
- List<String> items = new ArrayList<String>();
+ List<String> items = new ArrayList<>();
for ( Artifact artifact : dependencyResolver.resolveArtifact( surefireArtifact ).getArtifacts() )
{
getConsoleLogger().debug(
@@ -2780,7 +2754,7 @@ public abstract class AbstractSurefireMojo
}
@Override
- public void addProviderProperties() throws MojoExecutionException
+ public void addProviderProperties()
{
}
@@ -2821,7 +2795,7 @@ public abstract class AbstractSurefireMojo
}
@Override
- public void addProviderProperties() throws MojoExecutionException
+ public void addProviderProperties()
{
}
@@ -2858,7 +2832,7 @@ public abstract class AbstractSurefireMojo
}
@Override
- public void addProviderProperties() throws MojoExecutionException
+ public void addProviderProperties()
{
convertGroupParameters();
}
@@ -3046,69 +3020,18 @@ public abstract class AbstractSurefireMojo
return tmp;
}
- // todo use Java7 java.nio.file.Files.createTempDirectory()
File createSurefireBootDirectoryInTemp()
{
- if ( isBuiltInJava7AtLeast() )
- {
- try
- {
- return new File( SYSTEM_TMP_DIR, createTmpDirectoryNameWithJava7( getTempDir() ) );
- }
- catch ( IOException e )
- {
- return createSurefireBootDirectoryInBuild();
- }
- }
- else
- {
- try
- {
- File tmp = File.createTempFile( getTempDir(), null );
- //noinspection ResultOfMethodCallIgnored
- tmp.delete();
- return tmp.mkdirs() ? tmp : createSurefireBootDirectoryInBuild();
- }
- catch ( IOException e )
- {
- return createSurefireBootDirectoryInBuild();
- }
- }
- }
-
- /**
- * Reflection call of java.nio.file.Files.createTempDirectory( "surefire" ).
- * @return Java 7 NIO Path
- */
- static Object createTmpDirectoryWithJava7( String directoryPrefix )
- throws IOException
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Class<?> filesType = tryLoadClass( classLoader, "java.nio.file.Files" );
- Class<?> fileAttributeType = tryLoadClass( classLoader, "java.nio.file.attribute.FileAttribute" );
- Object attrs = Array.newInstance( fileAttributeType, 0 );
try
{
- return invokeStaticMethod( filesType, "createTempDirectory",
- new Class<?>[]{ String.class, attrs.getClass() },
- new Object[]{ directoryPrefix, attrs } );
+ return Files.createTempDirectory( getTempDir() ).toFile();
}
- catch ( SurefireReflectionException e )
+ catch ( IOException e )
{
- Throwable cause = e.getCause();
- throw cause instanceof IOException ? (IOException) cause : new IOException( cause );
+ return createSurefireBootDirectoryInBuild();
}
}
- static String createTmpDirectoryNameWithJava7( String directoryPrefix )
- throws IOException
- {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- Class<?> pathType = tryLoadClass( classLoader, "java.nio.file.Path" );
- Object path = createTmpDirectoryWithJava7( directoryPrefix );
- return invokeGetter( pathType, path, "getFileName" ).toString();
- }
-
@Override
public List<String> getExcludes()
{
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/JdkAttributes.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/JdkAttributes.java
index 65b1254..96049a5 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/JdkAttributes.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/JdkAttributes.java
@@ -19,7 +19,7 @@ package org.apache.maven.plugin.surefire;
* under the License.
*/
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
+import static java.util.Objects.requireNonNull;
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
index cf19eb0..b1dc25c 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
@@ -49,7 +49,7 @@ public class SurefireProperties
private static final Collection<String> KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES =
asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold", "line.separator" );
- private final LinkedHashSet<Object> items = new LinkedHashSet<Object>();
+ private final LinkedHashSet<Object> items = new LinkedHashSet<>();
public SurefireProperties()
{
@@ -123,7 +123,7 @@ public class SurefireProperties
public Set<Object> propertiesThatCannotBeSetASystemProperties()
{
- Set<Object> result = new HashSet<Object>();
+ Set<Object> result = new HashSet<>();
for ( Object key : getStringKeySet() )
{
if ( KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES.contains( key ) )
@@ -245,16 +245,12 @@ public class SurefireProperties
private static SurefireProperties loadProperties( InputStream inStream )
throws IOException
{
- try
+ try ( final InputStream surefirePropertiesStream = inStream )
{
Properties p = new Properties();
- p.load( inStream );
+ p.load( surefirePropertiesStream );
return new SurefireProperties( p );
}
- finally
- {
- close( inStream );
- }
}
public static SurefireProperties loadProperties( File file )
@@ -263,18 +259,6 @@ public class SurefireProperties
return file == null ? new SurefireProperties() : loadProperties( new FileInputStream( file ) );
}
- private static void close( InputStream inputStream )
- {
- try
- {
- inputStream.close();
- }
- catch ( IOException ex )
- {
- // ignore
- }
- }
-
public void setNullableProperty( String key, String value )
{
if ( value != null )
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
index 5931f9e..5f19f7f 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
@@ -29,7 +29,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
/**
* @author Kristian Rosenvold
@@ -38,7 +38,7 @@ public class ChecksumCalculator
{
private static final String HEX = "0123456789ABCDEF";
- private final List<Object> checksumItems = new ArrayList<Object>();
+ private final List<Object> checksumItems = new ArrayList<>();
private void appendObject( Object item )
{
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index 74645a4..0c9932d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -75,7 +75,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import static java.lang.StrictMath.min;
import static java.lang.System.currentTimeMillis;
import static java.lang.Thread.currentThread;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.util.Collections.addAll;
+import static java.util.Objects.requireNonNull;
import static java.util.concurrent.Executors.newScheduledThreadPool;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
@@ -95,8 +97,6 @@ import static org.apache.maven.surefire.suite.RunResult.timeout;
import static org.apache.maven.surefire.util.internal.ConcurrencyUtils.countDownToZero;
import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
-import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
/**
* Starts the fork or runs in-process.
@@ -165,7 +165,7 @@ public class ForkStarter
CloseableCloser( int jvmRun, Closeable... testProvidingInputStream )
{
this.jvmRun = jvmRun;
- this.testProvidingInputStream = new ConcurrentLinkedQueue<Closeable>();
+ this.testProvidingInputStream = new ConcurrentLinkedQueue<>();
addAll( this.testProvidingInputStream, testProvidingInputStream );
if ( this.testProvidingInputStream.isEmpty() )
{
@@ -228,14 +228,14 @@ public class ForkStarter
this.log = log;
defaultReporterFactory = new DefaultReporterFactory( startupReportConfiguration, log );
defaultReporterFactory.runStarting();
- defaultReporterFactories = new ConcurrentLinkedQueue<DefaultReporterFactory>();
- currentForkClients = new ConcurrentLinkedQueue<ForkClient>();
+ defaultReporterFactories = new ConcurrentLinkedQueue<>();
+ currentForkClients = new ConcurrentLinkedQueue<>();
timeoutCheckScheduler = createTimeoutCheckScheduler();
triggerTimeoutCheck();
}
public RunResult run( @Nonnull SurefireProperties effectiveSystemProperties, @Nonnull DefaultScanResult scanResult )
- throws SurefireBooterForkException, SurefireExecutionException
+ throws SurefireBooterForkException
{
try
{
@@ -317,14 +317,14 @@ public class ForkStarter
new ArrayBlockingQueue<Runnable>( forkCount ) );
executorService.setThreadFactory( FORKED_JVM_DAEMON_THREAD_FACTORY );
- final Queue<String> tests = new ConcurrentLinkedQueue<String>();
+ final Queue<String> tests = new ConcurrentLinkedQueue<>();
for ( Class<?> clazz : getSuitesIterator() )
{
tests.add( clazz.getName() );
}
- final Queue<TestProvidingInputStream> testStreams = new ConcurrentLinkedQueue<TestProvidingInputStream>();
+ final Queue<TestProvidingInputStream> testStreams = new ConcurrentLinkedQueue<>();
for ( int forkNum = 0, total = min( forkCount, tests.size() ); forkNum < total; forkNum++ )
{
@@ -339,7 +339,7 @@ public class ForkStarter
addShutDownHook( shutdown );
int failFastCount = providerConfiguration.getSkipAfterFailureCount();
final AtomicInteger notifyStreamsToSkipTestsJustNow = new AtomicInteger( failFastCount );
- final Collection<Future<RunResult>> results = new ArrayList<Future<RunResult>>( forkCount );
+ final Collection<Future<RunResult>> results = new ArrayList<>( forkCount );
final AtomicBoolean printedErrorStream = new AtomicBoolean();
for ( final TestProvidingInputStream testProvidingInputStream : testStreams )
{
@@ -401,7 +401,7 @@ public class ForkStarter
private RunResult runSuitesForkPerTestSet( final SurefireProperties effectiveSystemProperties, int forkCount )
throws SurefireBooterForkException
{
- ArrayList<Future<RunResult>> results = new ArrayList<Future<RunResult>>( 500 );
+ ArrayList<Future<RunResult>> results = new ArrayList<>( 500 );
ThreadPoolExecutor executorService =
new ThreadPoolExecutor( forkCount, forkCount, 60, SECONDS, new LinkedBlockingQueue<Runnable>() );
executorService.setThreadFactory( FORKED_JVM_DAEMON_THREAD_FACTORY );
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
index 3bcf7a3..72ae7da 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
@@ -96,8 +96,7 @@ public final class JarManifestForkConfiguration
file.deleteOnExit();
}
FileOutputStream fos = new FileOutputStream( file );
- JarOutputStream jos = new JarOutputStream( fos );
- try
+ try ( JarOutputStream jos = new JarOutputStream( fos ) )
{
jos.setLevel( JarOutputStream.STORED );
JarEntry je = new JarEntry( "META-INF/MANIFEST.MF" );
@@ -135,9 +134,5 @@ public final class JarManifestForkConfiguration
return file;
}
- finally
- {
- jos.close();
- }
}
}
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
index b6130c5..5b9bed4 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ModularClasspathForkConfiguration.java
@@ -117,11 +117,8 @@ public class ModularClasspathForkConfiguration
surefireArgs.deleteOnExit();
}
- BufferedWriter writer = null;
- try
+ try ( BufferedWriter writer = new BufferedWriter( new FileWriter( surefireArgs ) ) )
{
- writer = new BufferedWriter( new FileWriter( surefireArgs ) );
-
if ( !modulePath.isEmpty() )
{
writer.write( "--module-path" );
@@ -195,16 +192,9 @@ public class ModularClasspathForkConfiguration
writer.write( startClassName );
writer.newLine();
- }
- finally
- {
- if ( writer != null )
- {
- writer.close();
- }
- }
- return surefireArgs;
+ return surefireArgs;
+ }
}
@Nonnull
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
index 8cc0cdd..a884c15 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/AbstractForkInputStream.java
@@ -22,7 +22,7 @@ package org.apache.maven.plugin.surefire.booterclient.lazytestprovider;
import java.io.IOException;
import java.io.InputStream;
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
+import static java.util.Objects.requireNonNull;
/**
* Reader stream sends bytes to forked jvm std-{@link InputStream input-stream}.
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
index 5bce92a..0ea0a78 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
@@ -51,7 +51,7 @@ public class ConsoleOutputFileReporter
private final Integer forkNumber;
private final AtomicStampedReference<FilterOutputStream> fileOutputStream =
- new AtomicStampedReference<FilterOutputStream>( null, OPEN );
+ new AtomicStampedReference<>( null, OPEN );
private final ReentrantLock lock = new ReentrantLock();
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
index cd14b11..056e903 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
@@ -28,7 +28,7 @@ import org.apache.maven.surefire.report.ReportEntry;
import static java.nio.ByteBuffer.wrap;
import static java.nio.charset.Charset.defaultCharset;
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
+import static java.util.Objects.requireNonNull;
/**
* Outputs test system out/system err directly to the console
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
index 47ed4e7..290c252 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
@@ -93,23 +93,13 @@ public class FileReporter
public void testSetCompleted( WrappedReportEntry report, TestSetStats testSetStats, List<String> testResults )
{
- PrintWriter writer = null;
- try
+ try ( PrintWriter writer = testSetStarting( report ) )
{
- writer = testSetStarting( report );
writer.println( testSetStats.getTestSetSummary( report ) );
for ( String testResult : testResults )
{
writer.println( testResult );
}
- writer.flush();
- }
- finally
- {
- if ( writer != null )
- {
- writer.close();
- }
}
}
}
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 defd575..0f2b7e9 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
@@ -25,7 +25,6 @@ import org.apache.maven.shared.utils.xml.XMLWriter;
import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.ReporterException;
import org.apache.maven.surefire.report.SafeThrowable;
-import org.apache.maven.surefire.util.internal.StringUtils;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -42,11 +41,10 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
-import static org.apache.commons.io.IOUtils.closeQuietly;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType;
import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
import static org.apache.maven.plugin.surefire.report.ReportEntryType.SUCCESS;
-import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
@SuppressWarnings( { "javadoc", "checkstyle:javadoctype" } )
@@ -126,11 +124,10 @@ public class StatelessXmlReporter
}
OutputStream outputStream = getOutputStream( testSetReportEntry );
- OutputStreamWriter fw = getWriter( outputStream );
- try
+ try ( OutputStreamWriter fw = getWriter( outputStream ) )
{
XMLWriter ppw = new PrettyPrintXMLWriter( fw );
- ppw.setEncoding( StringUtils.UTF_8.name() );
+ ppw.setEncoding( UTF_8.name() );
createTestSuiteElement( ppw, testSetReportEntry, testSetStats, testSetReportEntry.elapsedTimeAsString() );
@@ -157,7 +154,7 @@ public class StatelessXmlReporter
if ( methodEntry.getReportEntryType() == SUCCESS )
{
startTestElement( ppw, methodEntry, reportNameSuffix,
- methodEntryList.get( 0 ).elapsedTimeAsString() );
+ methodEntryList.get( 0 ).elapsedTimeAsString() );
ppw.endElement();
}
}
@@ -166,7 +163,7 @@ public class StatelessXmlReporter
case failure:
// When rerunFailingTestsCount is set to larger than 0
startTestElement( ppw, methodEntryList.get( 0 ), reportNameSuffix,
- methodEntryList.get( 0 ).elapsedTimeAsString() );
+ methodEntryList.get( 0 ).elapsedTimeAsString() );
boolean firstRun = true;
for ( WrappedReportEntry singleRunEntry : methodEntryList )
{
@@ -174,13 +171,13 @@ public class StatelessXmlReporter
{
firstRun = false;
getTestProblems( fw, ppw, singleRunEntry, trimStackTrace, outputStream,
- singleRunEntry.getReportEntryType().getXmlTag(), false );
+ singleRunEntry.getReportEntryType().getXmlTag(), false );
createOutErrElements( fw, ppw, singleRunEntry, outputStream );
}
else
{
getTestProblems( fw, ppw, singleRunEntry, trimStackTrace, outputStream,
- singleRunEntry.getReportEntryType().getRerunXmlTag(), true );
+ singleRunEntry.getReportEntryType().getRerunXmlTag(), true );
}
}
ppw.endElement();
@@ -202,7 +199,7 @@ public class StatelessXmlReporter
if ( singleRunEntry.getReportEntryType() != SUCCESS )
{
getTestProblems( fw, ppw, singleRunEntry, trimStackTrace, outputStream,
- singleRunEntry.getReportEntryType().getFlakyXmlTag(), true );
+ singleRunEntry.getReportEntryType().getFlakyXmlTag(), true );
}
}
ppw.endElement();
@@ -210,9 +207,9 @@ public class StatelessXmlReporter
break;
case skipped:
startTestElement( ppw, methodEntryList.get( 0 ), reportNameSuffix,
- methodEntryList.get( 0 ).elapsedTimeAsString() );
+ methodEntryList.get( 0 ).elapsedTimeAsString() );
getTestProblems( fw, ppw, methodEntryList.get( 0 ), trimStackTrace, outputStream,
- methodEntryList.get( 0 ).getReportEntryType().getXmlTag(), false );
+ methodEntryList.get( 0 ).getReportEntryType().getXmlTag(), false );
ppw.endElement();
break;
default:
@@ -229,7 +226,7 @@ public class StatelessXmlReporter
if ( methodEntry.getReportEntryType() != SUCCESS )
{
getTestProblems( fw, ppw, methodEntry, trimStackTrace, outputStream,
- methodEntry.getReportEntryType().getXmlTag(), false );
+ methodEntry.getReportEntryType().getXmlTag(), false );
createOutErrElements( fw, ppw, methodEntry, outputStream );
}
ppw.endElement();
@@ -239,7 +236,7 @@ public class StatelessXmlReporter
}
ppw.endElement(); // TestSuite
}
- catch ( IOException e )
+ catch ( Exception e )
{
// It's not a test error.
// This method must be sail-safe and errors are in a dump log.
@@ -247,10 +244,6 @@ public class StatelessXmlReporter
InPluginProcessDumpSingleton.getSingleton()
.dumpException( e, e.getLocalizedMessage(), reportsDirectory );
}
- finally
- {
- closeQuietly( fw );
- }
}
/**
@@ -269,7 +262,7 @@ public class StatelessXmlReporter
*/
private TestResultType getTestResultType( List<WrappedReportEntry> methodEntryList )
{
- List<ReportEntryType> testResultTypeList = new ArrayList<ReportEntryType>();
+ List<ReportEntryType> testResultTypeList = new ArrayList<>();
for ( WrappedReportEntry singleRunEntry : methodEntryList )
{
testResultTypeList.add( singleRunEntry.getReportEntryType() );
@@ -319,7 +312,7 @@ public class StatelessXmlReporter
List<WrappedReportEntry> methodEntryList = methodRunHistoryMap.get( methodEntry.getName() );
if ( methodEntryList == null )
{
- methodEntryList = new ArrayList<WrappedReportEntry>();
+ methodEntryList = new ArrayList<>();
methodRunHistoryMap.put( methodEntry.getName(), methodEntryList );
}
methodEntryList.add( methodEntry );
@@ -333,7 +326,7 @@ public class StatelessXmlReporter
}
private static void startTestElement( XMLWriter ppw, WrappedReportEntry report, String reportNameSuffix,
- String timeAsString ) throws IOException
+ String timeAsString )
{
ppw.startElement( "testcase" );
ppw.addAttribute( "name", report.getReportName() );
@@ -356,7 +349,7 @@ public class StatelessXmlReporter
}
private void createTestSuiteElement( XMLWriter ppw, WrappedReportEntry report, TestSetStats testSetStats,
- String timeAsString ) throws IOException
+ String timeAsString )
{
ppw.startElement( "testsuite" );
@@ -383,7 +376,7 @@ public class StatelessXmlReporter
private static void getTestProblems( OutputStreamWriter outputStreamWriter, XMLWriter ppw,
WrappedReportEntry report, boolean trimStackTrace, OutputStream fw,
- String testErrorType, boolean createOutErrElementsInside ) throws IOException
+ String testErrorType, boolean createOutErrElementsInside )
{
ppw.startElement( testErrorType );
@@ -440,7 +433,7 @@ public class StatelessXmlReporter
// Create system-out and system-err elements
private static void createOutErrElements( OutputStreamWriter outputStreamWriter, XMLWriter ppw,
- WrappedReportEntry report, OutputStream fw ) throws IOException
+ WrappedReportEntry report, OutputStream fw )
{
EncodingOutputStream eos = new EncodingOutputStream( fw );
addOutputStreamElement( outputStreamWriter, eos, ppw, report.getStdout(), "system-out" );
@@ -450,7 +443,7 @@ public class StatelessXmlReporter
private static void addOutputStreamElement( OutputStreamWriter outputStreamWriter,
EncodingOutputStream eos, XMLWriter xmlWriter,
Utf8RecodingDeferredFileOutputStream utf8RecodingDeferredFileOutputStream,
- String name ) throws IOException
+ String name )
{
if ( utf8RecodingDeferredFileOutputStream != null && utf8RecodingDeferredFileOutputStream.getByteCount() > 0 )
{
@@ -480,7 +473,7 @@ public class StatelessXmlReporter
*
* @param xmlWriter The test suite to report to
*/
- private static void showProperties( XMLWriter xmlWriter, Map<String, String> systemProperties ) throws IOException
+ private static void showProperties( XMLWriter xmlWriter, Map<String, String> systemProperties )
{
xmlWriter.startElement( "properties" );
for ( final Entry<String, String> entry : systemProperties.entrySet() )
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 50c5b9c..8b496cd 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
@@ -27,7 +27,7 @@ import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
-import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
+import static java.nio.charset.StandardCharsets.UTF_8;
/**
* A deferred file output stream decorator that recodes the bytes written into the stream from the VM default encoding
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 5f76433..34e8e7f 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
@@ -58,7 +58,7 @@ public class DependencyScanner
public DefaultScanResult scan()
throws MojoExecutionException
{
- Set<String> classes = new LinkedHashSet<String>();
+ Set<String> classes = new LinkedHashSet<>();
for ( File artifact : dependenciesToScan )
{
if ( artifact != null && artifact.isFile() && artifact.getName().endsWith( ".jar" ) )
@@ -73,16 +73,14 @@ public class DependencyScanner
}
}
}
- return new DefaultScanResult( new ArrayList<String>( classes ) );
+ return new DefaultScanResult( new ArrayList<>( classes ) );
}
private static void scanArtifact( File artifact, TestFilter<String, String> filter, Set<String> classes )
throws IOException
{
- JarFile jar = null;
- try
+ try ( JarFile jar = new JarFile( artifact ) )
{
- jar = new JarFile( artifact );
for ( Enumeration<JarEntry> entries = jar.entries(); entries.hasMoreElements(); )
{
JarEntry entry = entries.nextElement();
@@ -93,18 +91,11 @@ public class DependencyScanner
}
}
}
- finally
- {
- if ( jar != null )
- {
- jar.close();
- }
- }
}
public static List<Artifact> filter( List<Artifact> artifacts, List<String> groupArtifactIds )
{
- List<Artifact> matches = new ArrayList<Artifact>();
+ List<Artifact> matches = new ArrayList<>();
if ( groupArtifactIds == null || artifacts == null )
{
return matches;
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/surefire/providerapi/ServiceLoader.java b/maven-surefire-common/src/main/java/org/apache/maven/surefire/providerapi/ServiceLoader.java
index 00b8b74..9350228 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/surefire/providerapi/ServiceLoader.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/surefire/providerapi/ServiceLoader.java
@@ -24,7 +24,6 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashSet;
@@ -52,7 +51,7 @@ public final class ServiceLoader
{
try
{
- Set<T> implementations = new HashSet<T>();
+ Set<T> implementations = new HashSet<>();
for ( String fullyQualifiedClassName : lookup( clazz, classLoader ) )
{
Class<?> implClass = classLoader.loadClass( fullyQualifiedClassName );
@@ -60,23 +59,7 @@ public final class ServiceLoader
}
return implementations;
}
- catch ( IOException e )
- {
- throw new IllegalStateException( e.getLocalizedMessage(), e );
- }
- catch ( ClassNotFoundException e )
- {
- throw new IllegalStateException( e.getLocalizedMessage(), e );
- }
- catch ( InvocationTargetException e )
- {
- throw new IllegalStateException( e.getLocalizedMessage(), e );
- }
- catch ( InstantiationException e )
- {
- throw new IllegalStateException( e.getLocalizedMessage(), e );
- }
- catch ( IllegalAccessException e )
+ catch ( IOException | ReflectiveOperationException e )
{
throw new IllegalStateException( e.getLocalizedMessage(), e );
}
@@ -109,13 +92,12 @@ public final class ServiceLoader
private static Set<String> lookupSpiImplementations( final Enumeration<URL> urlEnumeration )
throws IOException
{
- final Set<String> names = new HashSet<String>();
+ final Set<String> names = new HashSet<>();
nextUrl:
while ( urlEnumeration.hasMoreElements() )
{
final URL url = urlEnumeration.nextElement();
- final BufferedReader reader = getReader( url );
- try
+ try ( BufferedReader reader = getReader( url ) )
{
for ( String line; ( line = reader.readLine() ) != null; )
{
@@ -154,10 +136,6 @@ public final class ServiceLoader
}
}
}
- finally
- {
- reader.close();
- }
}
return names;
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
index 96a2a5c..e3c47d4 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
@@ -23,8 +23,6 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.surefire.log.PluginConsoleLogger;
import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.Classpath;
@@ -46,8 +44,6 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -58,7 +54,6 @@ import static java.util.Collections.singleton;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
import static org.apache.maven.artifact.versioning.VersionRange.createFromVersion;
-import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava7AtLeast;
import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.mockito.ArgumentMatchers.anyString;
@@ -155,7 +150,7 @@ public class AbstractSurefireMojoJava7PlusTest
@SuppressWarnings( "unchecked" )
ResolvePathsResult<String> res = mock( ResolvePathsResult.class );
when( res.getClasspathElements() ).thenReturn( asList( "non-modular.jar", "junit.jar", "hamcrest.jar" ) );
- Map<String, ModuleNameSource> mod = new LinkedHashMap<String, ModuleNameSource>();
+ Map<String, ModuleNameSource> mod = new LinkedHashMap<>();
mod.put( "modular.jar", null );
mod.put( "classes", null );
when( res.getModulepathElements() ).thenReturn( mod );
@@ -215,48 +210,6 @@ public class AbstractSurefireMojoJava7PlusTest
assertThat( ( Object ) mcc.getTestClasspath() ).isEqualTo( new Classpath( res.getClasspathElements() ) );
}
- @Test
- public void shouldHaveTmpDirectory() throws IOException
- {
- Path path = ( Path ) AbstractSurefireMojo.createTmpDirectoryWithJava7( "surefire" );
-
- assertThat( path )
- .isNotNull();
-
- assertThat( path.startsWith( System.getProperty( "java.io.tmpdir" ) ) )
- .isTrue();
-
- String dir = path.getName( path.getNameCount() - 1 ).toString();
-
- assertThat( dir )
- .startsWith( "surefire" );
-
- assertThat( dir )
- .matches( "^surefire[\\d]+$" );
- }
-
- @Test
- public void shouldHaveTmpDirectoryName() throws IOException
- {
- String dir = AbstractSurefireMojo.createTmpDirectoryNameWithJava7( "surefire" );
-
- assertThat( dir )
- .isNotNull();
-
- assertThat( dir )
- .startsWith( "surefire" );
-
- assertThat( dir )
- .matches( "^surefire[\\d]+$" );
- }
-
- @Test
- public void shouldTestIsJava7()
- {
- assertThat( isBuiltInJava7AtLeast() )
- .isTrue();
- }
-
private static File mockFile( String absolutePath )
{
File f = mock( File.class );
@@ -594,7 +547,6 @@ public class AbstractSurefireMojoJava7PlusTest
@Override
protected void handleSummary( RunResult summary, Exception firstForkException )
- throws MojoExecutionException, MojoFailureException
{
}
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
index 91589a2..597527b 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
@@ -24,7 +24,6 @@ import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.surefire.suite.RunResult;
import org.apache.maven.surefire.util.DefaultScanResult;
@@ -110,13 +109,14 @@ public class MojoMocklessTest
File artifactFile = File.createTempFile( "surefire", ".jar" );
testDeps.setFile( artifactFile );
- ZipOutputStream os = new ZipOutputStream( new FileOutputStream( artifactFile ) );
- os.putNextEntry( new ZipEntry( "pkg/" ) );
- os.closeEntry();
- os.putNextEntry( new ZipEntry( "pkg/MyTest.class" ) );
- os.closeEntry();
- os.finish();
- os.close();
+ try ( ZipOutputStream os = new ZipOutputStream( new FileOutputStream( artifactFile ) ) )
+ {
+ os.putNextEntry( new ZipEntry( "pkg/" ) );
+ os.closeEntry();
+ os.putNextEntry( new ZipEntry( "pkg/MyTest.class" ) );
+ os.closeEntry();
+ os.finish();
+ }
List<Artifact> projectTestArtifacts = singletonList( testDeps );
String[] dependenciesToScan = { "g:a" };
@@ -143,11 +143,12 @@ public class MojoMocklessTest
File artifactFile = File.createTempFile( "surefire", ".jar" );
testDeps.setFile( artifactFile );
- ZipOutputStream os = new ZipOutputStream( new FileOutputStream( artifactFile ) );
- os.putNextEntry( new ZipEntry( "pkg/" ) );
- os.closeEntry();
- os.finish();
- os.close();
+ try ( ZipOutputStream os = new ZipOutputStream( new FileOutputStream( artifactFile ) ) )
+ {
+ os.putNextEntry( new ZipEntry( "pkg/" ) );
+ os.closeEntry();
+ os.finish();
+ }
List<Artifact> projectTestArtifacts = singletonList( testDeps );
String[] dependenciesToScan = { "g:a" };
@@ -217,13 +218,14 @@ public class MojoMocklessTest
Artifact testDep2 = new DefaultArtifact( "g", "a", version, "test", "jar", null, handler );
File artifactFile2 = File.createTempFile( "surefire", ".jar" );
testDep2.setFile( artifactFile2 );
- ZipOutputStream os = new ZipOutputStream( new FileOutputStream( artifactFile2 ) );
- os.putNextEntry( new ZipEntry( "pkg/" ) );
- os.closeEntry();
- os.putNextEntry( new ZipEntry( "pkg/MyTest.class" ) );
- os.closeEntry();
- os.finish();
- os.close();
+ try ( ZipOutputStream os = new ZipOutputStream( new FileOutputStream( artifactFile2 ) ) )
+ {
+ os.putNextEntry( new ZipEntry( "pkg/" ) );
+ os.closeEntry();
+ os.putNextEntry( new ZipEntry( "pkg/MyTest.class" ) );
+ os.closeEntry();
+ os.finish();
+ }
List<Artifact> projectTestArtifacts = asList( testDep1, testDep2 );
String[] dependenciesToScan = { "g:a" };
@@ -587,7 +589,6 @@ public class MojoMocklessTest
@Override
protected void handleSummary( RunResult summary, Exception firstForkException )
- throws MojoExecutionException, MojoFailureException
{
}
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStreamTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStreamTest.java
index 611e497..d120638 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStreamTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStreamTest.java
@@ -49,7 +49,7 @@ public class TestProvidingInputStreamTest
public void closedStreamShouldReturnEndOfStream()
throws IOException
{
- Queue<String> commands = new ArrayDeque<String>();
+ Queue<String> commands = new ArrayDeque<>();
TestProvidingInputStream is = new TestProvidingInputStream( commands );
is.close();
assertThat( is.read(), is( -1 ) );
@@ -59,10 +59,10 @@ public class TestProvidingInputStreamTest
public void emptyStreamShouldWaitUntilClosed()
throws Exception
{
- Queue<String> commands = new ArrayDeque<String>();
+ Queue<String> commands = new ArrayDeque<>();
final TestProvidingInputStream is = new TestProvidingInputStream( commands );
final Thread streamThread = Thread.currentThread();
- FutureTask<Thread.State> futureTask = new FutureTask<Thread.State>( new Callable<Thread.State>()
+ FutureTask<Thread.State> futureTask = new FutureTask<>( new Callable<Thread.State>()
{
@Override
public Thread.State call()
@@ -84,7 +84,7 @@ public class TestProvidingInputStreamTest
public void finishedTestsetShouldNotBlock()
throws IOException
{
- Queue<String> commands = new ArrayDeque<String>();
+ Queue<String> commands = new ArrayDeque<>();
final TestProvidingInputStream is = new TestProvidingInputStream( commands );
is.testSetFinished();
new Thread( new Runnable()
@@ -111,7 +111,7 @@ public class TestProvidingInputStreamTest
public void shouldReadTest()
throws IOException
{
- Queue<String> commands = new ArrayDeque<String>();
+ Queue<String> commands = new ArrayDeque<>();
commands.add( "Test" );
final TestProvidingInputStream is = new TestProvidingInputStream( commands );
new Thread( new Runnable()
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 445eaa8..6cb5ba7 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
@@ -38,8 +38,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.maven.surefire.util.internal.ObjectUtils.systemProps;
-import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
@SuppressWarnings( "ResultOfMethodCallIgnored" )
public class StatelessXmlReporterTest
@@ -74,7 +74,6 @@ public class StatelessXmlReporterTest
@Override
protected void tearDown()
- throws Exception
{
if ( expectedReportFile != null )
{
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java
index b9335d6..e55c6a9 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/util/DependenciesScannerTest.java
@@ -49,14 +49,14 @@ public class DependenciesScannerTest
"jar", "tests", null );
artifact.setFile( testFile );
- List<String> scanDependencies = new ArrayList<String>();
+ List<String> scanDependencies = new ArrayList<>();
scanDependencies.add( "org.surefire.dependency:test-jar" );
- List<String> include = new ArrayList<String>();
+ List<String> include = new ArrayList<>();
include.add( "**/*A.java" );
- List<String> exclude = new ArrayList<String>();
+ List<String> exclude = new ArrayList<>();
- List<File> dependenciesToScan = new ArrayList<File>();
+ List<File> dependenciesToScan = new ArrayList<>();
for ( Artifact a : DependencyScanner.filter( Collections.singletonList( artifact ), scanDependencies ) )
{
dependenciesToScan.add( a.getFile() );
@@ -69,7 +69,7 @@ public class DependenciesScannerTest
assertNotNull( classNames );
assertEquals( 1, classNames.size() );
- Map<String, String> props = new HashMap<String, String>();
+ Map<String, String> props = new HashMap<>();
classNames.writeTo( props );
assertEquals( 1, props.size() );
}
@@ -80,8 +80,7 @@ public class DependenciesScannerTest
File output = new File( "target/DependenciesScannerTest-tests.jar" );
output.delete();
- ZipOutputStream out = new ZipOutputStream( new FileOutputStream( output ) );
- try
+ try ( ZipOutputStream out = new ZipOutputStream( new FileOutputStream( output ) ) )
{
out.putNextEntry( new ZipEntry( "org/test/TestA.class" ) );
out.closeEntry();
@@ -89,9 +88,5 @@ public class DependenciesScannerTest
out.closeEntry();
return output;
}
- finally
- {
- out.close();
- }
}
}
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
index 2ee6186..45b264b 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
@@ -31,7 +31,7 @@ import org.apache.maven.plugin.surefire.report.ConsoleOutputFileReporter;
import junit.framework.TestCase;
import org.apache.maven.shared.utils.io.FileUtils;
-import static org.apache.maven.surefire.util.internal.StringUtils.US_ASCII;
+import static java.nio.charset.StandardCharsets.US_ASCII;
import static org.fest.assertions.Assertions.assertThat;
public class ConsoleOutputFileReporterTest
@@ -122,7 +122,7 @@ public class ConsoleOutputFileReporterTest
final ConsoleOutputFileReporter reporter = new ConsoleOutputFileReporter( reportDir, null, null );
reporter.testSetStarting( new SimpleReportEntry( getClass().getName(), getClass().getName() ) );
ExecutorService scheduler = Executors.newFixedThreadPool( 10 );
- final ArrayList<Callable<Void>> jobs = new ArrayList<Callable<Void>>();
+ final ArrayList<Callable<Void>> jobs = new ArrayList<>();
for ( int i = 0; i < 10; i++ )
{
jobs.add( new Callable<Void>() {
diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml
index fc98d56..18270aa 100644
--- a/maven-surefire-report-plugin/pom.xml
+++ b/maven-surefire-report-plugin/pom.xml
@@ -149,7 +149,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <useSystemClassLoader>true</useSystemClassLoader>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.fusesource.jansi:jansi</classpathDependencyExclude>
</classpathDependencyExcludes>
diff --git a/pom.xml b/pom.xml
index e762884..da571ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,13 +84,14 @@
</distributionManagement>
<properties>
+ <javaVersion>7</javaVersion>
<mavenVersion>3.0</mavenVersion>
<!-- <shadedVersion>2.12.4</shadedVersion> commented out due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
- <commonsLang3Version>3.5</commonsLang3Version>
- <commonsIoVersion>2.5</commonsIoVersion>
+ <commonsLang3Version>3.8.1</commonsLang3Version>
+ <commonsIoVersion>2.6</commonsIoVersion>
<!-- maven-shared-utils:3.2.0+ another behavior - broke Surefire performance - end of subprocess notification not arrived in ForkStarter -->
<mavenSharedUtilsVersion>3.1.0</mavenSharedUtilsVersion>
- <powermockVersion>2.0.0-beta.5</powermockVersion>
+ <powermockVersion>2.0.0-RC.1</powermockVersion>
<maven.surefire.scm.devConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-surefire.git</maven.surefire.scm.devConnection>
<maven.site.path>surefire-archives/surefire-LATEST</maven.site.path>
<!-- Override with Jigsaw JRE 9 -->
@@ -259,26 +260,6 @@
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<version>${powermockVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy-agent</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- <version>1.8.17</version>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy-agent</artifactId>
- <version>1.8.17</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
@@ -403,7 +384,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.16</version>
+ <version>1.17</version>
<executions>
<execution>
<id>signature-check</id>
@@ -413,8 +394,8 @@
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
- <artifactId>java16</artifactId>
- <version>1.1</version>
+ <artifactId>java17</artifactId>
+ <version>1.0</version>
</signature>
<excludeDependencies>
<param>org.codehaus.plexus:plexus-java</param>
@@ -503,7 +484,7 @@
<configuration>
<rules>
<requireJavaVersion>
- <!-- We use JDK 1.8 to check -Xdoclint:all at compile time but with javac -source 1.6 -target 1.6 -->
+ <!-- We use JDK 1.8 to check -Xdoclint:all at compile time but with javac -source 1.7 -target 1.7 -->
<!-- enforcer:1.3.1 fails on jdk9. 3.0.0-M2 does not but surefire:12.2.4 crashes later. -->
<version>[1.8, 1.9)</version>
</requireJavaVersion>
diff --git a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
index dc871a5..ab93d62 100644
--- a/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
+++ b/surefire-api/src/main/java/org/apache/maven/plugin/surefire/runorder/RunEntryStatisticsMap.java
@@ -57,7 +57,7 @@ public final class RunEntryStatisticsMap
public RunEntryStatisticsMap()
{
- runEntryStatistics = new ConcurrentHashMap<String, RunEntryStatistics>();
+ runEntryStatistics = new ConcurrentHashMap<>();
}
public static RunEntryStatisticsMap fromFile( File file )
@@ -68,10 +68,6 @@ public final class RunEntryStatisticsMap
{
return fromReader( new FileReader( file ) );
}
- catch ( FileNotFoundException e )
- {
- throw new RuntimeException( e );
- }
catch ( IOException e )
{
throw new RuntimeException( e );
@@ -86,7 +82,7 @@ public final class RunEntryStatisticsMap
static RunEntryStatisticsMap fromReader( Reader fileReader )
throws IOException
{
- Map<String, RunEntryStatistics> result = new HashMap<String, RunEntryStatistics>();
+ Map<String, RunEntryStatistics> result = new HashMap<>();
BufferedReader bufferedReader = new BufferedReader( fileReader );
String line = bufferedReader.readLine();
while ( line != null )
@@ -105,20 +101,14 @@ public final class RunEntryStatisticsMap
throws FileNotFoundException
{
FileOutputStream fos = new FileOutputStream( file );
- PrintWriter printWriter = new PrintWriter( fos );
- try
+ try ( PrintWriter printWriter = new PrintWriter( fos ) )
{
- List<RunEntryStatistics> items = new ArrayList<RunEntryStatistics>( runEntryStatistics.values() );
+ List<RunEntryStatistics> items = new ArrayList<>( runEntryStatistics.values() );
sort( items, new RunCountComparator() );
for ( RunEntryStatistics item : items )
{
printWriter.println( item.toString() );
}
- printWriter.flush();
- }
- finally
- {
- printWriter.close();
}
}
@@ -181,7 +171,7 @@ public final class RunEntryStatisticsMap
{
Map classPriorities = getPriorities( priorityComparator );
- List<PrioritizedTest> tests = new ArrayList<PrioritizedTest>();
+ List<PrioritizedTest> tests = new ArrayList<>();
for ( Class<?> clazz : testsToRun )
{
Priority pri = (Priority) classPriorities.get( clazz.getName() );
@@ -198,7 +188,7 @@ public final class RunEntryStatisticsMap
private List<Class<?>> transformToClasses( List<PrioritizedTest> tests )
{
- List<Class<?>> result = new ArrayList<Class<?>>();
+ List<Class<?>> result = new ArrayList<>();
for ( PrioritizedTest test : tests )
{
result.add( test.getClazz() );
@@ -208,7 +198,7 @@ public final class RunEntryStatisticsMap
private Map getPriorities( Comparator<Priority> priorityComparator )
{
- Map<String, Priority> priorities = new HashMap<String, Priority>();
+ Map<String, Priority> priorities = new HashMap<>();
for ( Object o : runEntryStatistics.keySet() )
{
String testNames = (String) o;
@@ -224,9 +214,9 @@ public final class RunEntryStatisticsMap
priority.addItem( itemStat );
}
- List<Priority> items = new ArrayList<Priority>( priorities.values() );
+ List<Priority> items = new ArrayList<>( priorities.values() );
sort( items, priorityComparator );
- Map<String, Priority> result = new HashMap<String, Priority>();
+ Map<String, Priority> result = new HashMap<>();
int i = 0;
for ( Priority pri : items )
{
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
index 5024992..c5e5857 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/Command.java
@@ -19,7 +19,7 @@ package org.apache.maven.surefire.booter;
* under the License.
*/
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
+import static java.util.Objects.requireNonNull;
import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
import static org.apache.maven.surefire.booter.MasterProcessCommand.RUN_CLASS;
import static org.apache.maven.surefire.booter.MasterProcessCommand.SHUTDOWN;
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
index c3d80ea..be39ba7 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
@@ -36,6 +36,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;
+import static java.util.Objects.requireNonNull;
import static java.lang.Thread.State.NEW;
import static java.lang.Thread.State.RUNNABLE;
import static java.lang.Thread.State.TERMINATED;
@@ -53,7 +54,6 @@ import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDae
import static org.apache.maven.surefire.util.internal.StringUtils.encodeStringForForkCommunication;
import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
/**
* Reader of commands coming from plugin(master) process.
@@ -67,18 +67,17 @@ public final class CommandReader
private static final CommandReader READER = new CommandReader();
- private final Queue<BiProperty<MasterProcessCommand, CommandListener>> listeners
- = new ConcurrentLinkedQueue<BiProperty<MasterProcessCommand, CommandListener>>();
+ private final Queue<BiProperty<MasterProcessCommand, CommandListener>> listeners = new ConcurrentLinkedQueue<>();
private final Thread commandThread = newDaemonThread( new CommandRunnable(), "surefire-forkedjvm-command-thread" );
- private final AtomicReference<Thread.State> state = new AtomicReference<Thread.State>( NEW );
+ private final AtomicReference<Thread.State> state = new AtomicReference<>( NEW );
private final CountDownLatch startMonitor = new CountDownLatch( 1 );
private final Semaphore nextCommandNotifier = new Semaphore( 0 );
- private final CopyOnWriteArrayList<String> testClasses = new CopyOnWriteArrayList<String>();
+ private final CopyOnWriteArrayList<String> testClasses = new CopyOnWriteArrayList<>();
private volatile Shutdown shutdown;
@@ -174,7 +173,7 @@ public final class CommandReader
private void addListener( MasterProcessCommand cmd, CommandListener listener )
{
- listeners.add( new BiProperty<MasterProcessCommand, CommandListener>( cmd, listener ) );
+ listeners.add( new BiProperty<>( cmd, listener ) );
}
public void removeListener( CommandListener listener )
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
index 5d47212..1f95179 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/MasterProcessCommand.java
@@ -23,9 +23,9 @@ import java.io.DataInputStream;
import java.io.IOException;
import static java.lang.String.format;
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
-import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
-import static org.apache.maven.surefire.util.internal.StringUtils.US_ASCII;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
+import static java.nio.charset.StandardCharsets.US_ASCII;
+import static java.util.Objects.requireNonNull;
import static org.apache.maven.surefire.util.internal.StringUtils.encodeStringForForkCommunication;
/**
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 dee095c..7a8fd56 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
@@ -54,15 +54,9 @@ public class LegacyPojoStackTraceWriter
if ( t != null )
{
StringWriter w = new StringWriter();
- PrintWriter stackTrace = new PrintWriter( w );
- try
+ try ( PrintWriter stackTrace = new PrintWriter( w ) )
{
t.printStackTrace( stackTrace );
- stackTrace.flush();
- }
- finally
- {
- stackTrace.close();
}
StringBuffer builder = w.getBuffer();
if ( isMultiLineExceptionMessage( t ) )
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java b/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
index e318e1f..8145e51 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/suite/RunResult.java
@@ -102,15 +102,9 @@ public class RunResult
return null;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
- PrintWriter pw = new PrintWriter( out );
- try
+ try ( PrintWriter pw = new PrintWriter( out ) )
{
e.printStackTrace( pw );
- pw.flush();
- }
- finally
- {
- pw.close();
}
return new String( out.toByteArray() );
}
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
index 49f8f09..63b30ff 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/ReflectionUtils.java
@@ -94,15 +94,7 @@ public final class ReflectionUtils
{
return constructor.newInstance( params );
}
- catch ( InvocationTargetException e )
- {
- throw new SurefireReflectionException( e );
- }
- catch ( InstantiationException e )
- {
- throw new SurefireReflectionException( e );
- }
- catch ( IllegalAccessException e )
+ catch ( ReflectiveOperationException e )
{
throw new SurefireReflectionException( e );
}
@@ -115,11 +107,7 @@ public final class ReflectionUtils
Class<?> clazz = loadClass( classLoader, classname );
return returnType.cast( clazz.newInstance() );
}
- catch ( InstantiationException e )
- {
- throw new SurefireReflectionException( e );
- }
- catch ( IllegalAccessException e )
+ catch ( ReflectiveOperationException e )
{
throw new SurefireReflectionException( e );
}
@@ -138,11 +126,7 @@ public final class ReflectionUtils
{
throw new SurefireReflectionException( e.getTargetException() );
}
- catch ( InstantiationException e )
- {
- throw new SurefireReflectionException( e );
- }
- catch ( IllegalAccessException e )
+ catch ( ReflectiveOperationException e )
{
throw new SurefireReflectionException( e );
}
@@ -161,11 +145,7 @@ public final class ReflectionUtils
{
throw new SurefireReflectionException( e.getTargetException() );
}
- catch ( InstantiationException e )
- {
- throw new SurefireReflectionException( e );
- }
- catch ( IllegalAccessException e )
+ catch ( ReflectiveOperationException e )
{
throw new SurefireReflectionException( e );
}
@@ -225,10 +205,7 @@ public final class ReflectionUtils
{
return classLoader.loadClass( className );
}
- catch ( NoClassDefFoundError ignore )
- {
- }
- catch ( ClassNotFoundException ignore )
+ catch ( NoClassDefFoundError | ClassNotFoundException ignore )
{
}
return null;
@@ -240,11 +217,7 @@ public final class ReflectionUtils
{
return classLoader.loadClass( className );
}
- catch ( NoClassDefFoundError e )
- {
- throw new SurefireReflectionException( e );
- }
- catch ( ClassNotFoundException e )
+ catch ( NoClassDefFoundError | ClassNotFoundException e )
{
throw new SurefireReflectionException( e );
}
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/DumpFileUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/DumpFileUtils.java
index cc2d04a..794f8d0 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/DumpFileUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/DumpFileUtils.java
@@ -28,7 +28,7 @@ import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.Date;
-import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
+import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Dumps a text or exception in dump file.
@@ -67,18 +67,17 @@ public final class DumpFileUtils
if ( t != null && dumpFile != null
&& ( dumpFile.exists() || mkdirs( dumpFile ) && dumpFile.createNewFile() ) )
{
- Writer fw = createWriter( dumpFile );
- if ( msg != null )
+ try ( PrintWriter pw = new PrintWriter( createWriter( dumpFile ) ) )
{
- fw.append( msg )
- .append( StringUtils.NL );
+ if ( msg != null )
+ {
+ pw.append( msg )
+ .append( StringUtils.NL );
+ }
+ t.printStackTrace( pw );
+ pw.append( StringUtils.NL )
+ .append( StringUtils.NL );
}
- PrintWriter pw = new PrintWriter( fw );
- t.printStackTrace( pw );
- pw.flush();
- fw.append( StringUtils.NL )
- .append( StringUtils.NL )
- .close();
}
}
catch ( Exception e )
@@ -94,11 +93,12 @@ public final class DumpFileUtils
if ( msg != null && dumpFile != null
&& ( dumpFile.exists() || mkdirs( dumpFile ) && dumpFile.createNewFile() ) )
{
- createWriter( dumpFile )
- .append( msg )
- .append( StringUtils.NL )
- .append( StringUtils.NL )
- .close();
+ try ( Writer writer = createWriter( dumpFile ) )
+ {
+ writer.append( msg )
+ .append( StringUtils.NL )
+ .append( StringUtils.NL );
+ }
}
}
catch ( Exception e )
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java
index bc4fdd9..254587f 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/ObjectUtils.java
@@ -37,47 +37,7 @@ public final class ObjectUtils
public static <T> T useNonNull( T target, T fallback )
{
- return isNull( target ) ? fallback : target;
- }
-
- /*
- * In JDK7 use java.util.Objects instead.
- * todo
- * */
- public static boolean isNull( Object target )
- {
- return target == null;
- }
-
- /*
- * In JDK7 use java.util.Objects instead.
- * todo
- * */
- public static boolean nonNull( Object target )
- {
- return !isNull( target );
- }
-
- /*
- * In JDK7 use java.util.Objects instead.
- * todo
- * */
- public static <T> T requireNonNull( T obj, String message )
- {
- if ( isNull( obj ) )
- {
- throw new NullPointerException( message );
- }
- return obj;
- }
-
- /*
- * In JDK7 use java.util.Objects instead.
- * todo
- * */
- public static <T> T requireNonNull( T obj )
- {
- return requireNonNull( obj, null );
+ return target == null ? fallback : target;
}
public static Map<String, String> systemProps()
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
index 2a0783e..ea80ba9 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/StringUtils.java
@@ -25,6 +25,8 @@ import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
+
/**
* <p>
* Common {@link String java.lang.String} manipulation routines.
@@ -59,17 +61,6 @@ public final class StringUtils
private static final Charset DEFAULT_CHARSET = Charset.defaultCharset();
- /**
- * TODO
- * Use JDK7 StandardCharsets
- */
- public static final Charset US_ASCII = Charset.forName( "US-ASCII" );
-
- // 8-bit charset Latin-1
- public static final Charset ISO_8859_1 = Charset.forName( "ISO-8859-1" );
-
- public static final Charset UTF_8 = Charset.forName( "UTF-8" );
-
private StringUtils()
{
throw new IllegalStateException( "no instantiable constructor" );
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/UrlUtils.java b/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/UrlUtils.java
deleted file mode 100644
index dd96f28..0000000
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/internal/UrlUtils.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.apache.maven.surefire.util.internal;
-
-/*
- * 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 java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.BitSet;
-
-import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
-
-/**
- * Utility for dealing with URLs in pre-JDK 1.4.
- */
-public final class UrlUtils
-{
- private static final BitSet UNRESERVED = new BitSet( Byte.MAX_VALUE - Byte.MIN_VALUE + 1 );
-
- private static final int RADIX = 16;
-
- private static final int MASK = 0xf;
-
- private UrlUtils()
- {
- throw new IllegalStateException( "no instantiable constructor" );
- }
-
- static
- {
- byte[] bytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.!~*'():/".getBytes( UTF_8 );
- for ( byte aByte : bytes )
- {
- UNRESERVED.set( aByte );
- }
- }
-
- public static URL toURL( File file )
- throws MalformedURLException
- {
- // with JDK 1.4+, code would be: return new URL( file.toURI().toASCIIString() );
- //noinspection deprecation
- URL url = file.toURL();
- // encode any characters that do not comply with RFC 2396
- // this is primarily to handle Windows where the user's home directory contains spaces
- byte[] bytes = url.toString().getBytes( UTF_8 );
- StringBuilder buf = new StringBuilder( bytes.length );
- for ( byte b : bytes )
- {
- if ( b > 0 && UNRESERVED.get( b ) )
- {
- buf.append( (char) b );
- }
- else
- {
- buf.append( '%' );
- buf.append( Character.forDigit( b >>> 4 & MASK, RADIX ) );
- buf.append( Character.forDigit( b & MASK, RADIX ) );
- }
- }
- return new URL( buf.toString() );
- }
-}
diff --git a/surefire-api/src/test/java/org/apache/maven/JUnit4SuiteTest.java b/surefire-api/src/test/java/org/apache/maven/JUnit4SuiteTest.java
index 66cca64..dad6079 100644
--- a/surefire-api/src/test/java/org/apache/maven/JUnit4SuiteTest.java
+++ b/surefire-api/src/test/java/org/apache/maven/JUnit4SuiteTest.java
@@ -37,7 +37,6 @@ import org.apache.maven.surefire.util.RunOrderCalculatorTest;
import org.apache.maven.surefire.util.RunOrderTest;
import org.apache.maven.surefire.util.ScanResultTest;
import org.apache.maven.surefire.util.TestsToRunTest;
-import org.apache.maven.surefire.util.UrlUtilsTest;
import org.apache.maven.surefire.util.internal.ConcurrencyUtilsTest;
import org.apache.maven.surefire.util.internal.ImmutableMapTest;
import org.apache.maven.surefire.util.internal.StringUtilsTest;
@@ -66,7 +65,6 @@ import org.junit.runners.Suite;
RunOrderTest.class,
ScanResultTest.class,
TestsToRunTest.class,
- UrlUtilsTest.class,
SpecificTestClassFilterTest.class,
FundamentalFilterTest.class,
ImmutableMapTest.class,
diff --git a/surefire-api/src/test/java/org/apache/maven/surefire/util/UrlUtilsTest.java b/surefire-api/src/test/java/org/apache/maven/surefire/util/UrlUtilsTest.java
deleted file mode 100644
index d5ecc46..0000000
--- a/surefire-api/src/test/java/org/apache/maven/surefire/util/UrlUtilsTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.apache.maven.surefire.util;
-
-/*
- * 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 java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import static org.apache.maven.surefire.util.internal.UrlUtils.toURL;
-
-/**
- * Test the URL utilities.
- */
-public class UrlUtilsTest
- extends TestCase
-{
- private String homeDir;
-
- @Override
- public void setUp()
- throws Exception
- {
- super.setUp();
- homeDir = System.getProperty( "user.dir" );
- if ( !homeDir.startsWith( "/" ) )
- {
- homeDir = "/" + homeDir;
- }
- }
-
- private void verifyFileName( String fileName )
- throws Exception
- {
- verifyFileName( fileName, fileName );
- }
-
- private void verifyFileName( String fileName, String expectedFileName )
- throws Exception
- {
- File f = new File( homeDir, fileName );
- URL u = toURL( f );
- URI uri = u.toURI();
- File urlFile = new File( uri );
- String url = u.toString();
-
- assertStartsWith( url, "file:" );
- assertEndsWith( url, expectedFileName );
- assertEquals( f, urlFile );
- }
-
- private void assertStartsWith( String string, String substring )
- {
- assertTrue( "<" + string + "> should start with <" + substring + ">", string.startsWith( substring ) );
- }
-
- private void assertEndsWith( String string, String substring )
- {
- assertTrue( "<" + string + "> should end with <" + substring + ">", string.endsWith( substring ) );
- }
-
- public void testTestNoSpecialCharacters()
- throws Exception
- {
- verifyFileName( "foo.txt" );
- verifyFileName( "qwertyuiopasdfghjklzxcvbnm.txt" );
- verifyFileName( "QWERTYUIOPASDFGHJKLZXCVBNM.txt" );
- verifyFileName( "1234567890.txt" );
- verifyFileName( ")('*~!._-.txt" );
- }
-
- public void testTestWithSpaces()
- throws Exception
- {
- verifyFileName( "foo bar.txt", "foo%20bar.txt" );
- }
-
- public void testTestWithUmlaut()
- throws Exception
- {
- verifyFileName( "fo\u00DC.txt", "fo%c3%9c.txt" );
- }
-
-}
diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml
index bab1175..929ddb8 100644
--- a/surefire-booter/pom.xml
+++ b/surefire-booter/pom.xml
@@ -81,16 +81,6 @@
<artifactId>powermock-api-mockito2</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.bytebuddy</groupId>
- <artifactId>byte-buddy-agent</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
index 988d2ee..048f6fc 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/Classpath.java
@@ -22,7 +22,6 @@ package org.apache.maven.surefire.booter;
import javax.annotation.Nonnull;
import java.io.File;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -31,7 +30,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import static java.io.File.pathSeparatorChar;
-import static org.apache.maven.surefire.util.internal.UrlUtils.toURL;
/**
* An ordered list of classpath elements with set behaviour
@@ -48,7 +46,7 @@ public final class Classpath implements Iterable<String>, Cloneable
public static Classpath join( Classpath firstClasspath, Classpath secondClasspath )
{
- LinkedHashSet<String> accumulated = new LinkedHashSet<String>();
+ LinkedHashSet<String> accumulated = new LinkedHashSet<>();
if ( firstClasspath != null )
{
firstClasspath.addTo( accumulated );
@@ -72,14 +70,14 @@ public final class Classpath implements Iterable<String>, Cloneable
public Classpath( @Nonnull Classpath other, @Nonnull String additionalElement )
{
- ArrayList<String> elems = new ArrayList<String>( other.unmodifiableElements );
+ ArrayList<String> elems = new ArrayList<>( other.unmodifiableElements );
elems.add( additionalElement );
unmodifiableElements = Collections.unmodifiableList( elems );
}
public Classpath( @Nonnull Collection<String> elements )
{
- List<String> newCp = new ArrayList<String>( elements.size() );
+ List<String> newCp = new ArrayList<>( elements.size() );
for ( String element : elements )
{
element = element.trim();
@@ -111,26 +109,6 @@ public final class Classpath implements Iterable<String>, Cloneable
return unmodifiableElements;
}
- /**
- * @deprecated this should be package private method which returns List of Files. It will be
- * removed in the next major version.
- *
- * @return list of {@link URL jar files paths} with {@code file} protocol in URL.
- * @throws MalformedURLException if {@link URL} could not be created upon given class-path element(s)
- */
- @Deprecated
- public List<URL> getAsUrlList()
- throws MalformedURLException
- {
- List<URL> urls = new ArrayList<URL>();
- for ( String url : unmodifiableElements )
- {
- File f = new File( url );
- urls.add( toURL( f ) );
- }
- return urls;
- }
-
public void writeToSystemProperty( @Nonnull String propertyName )
{
StringBuilder sb = new StringBuilder();
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
index 00f62e5..d69c419 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PpidChecker.java
@@ -66,7 +66,7 @@ final class PpidChecker
private static final String SYSTEM_PATH_TO_WMIC =
"%" + WINDOWS_SYSTEM_ROOT_ENV + "%\\" + RELATIVE_PATH_TO_WMIC + "\\";
- private final Queue<Process> destroyableCommands = new ConcurrentLinkedQueue<Process>();
+ private final Queue<Process> destroyableCommands = new ConcurrentLinkedQueue<>();
/**
* The etime is in the form of [[dd-]hh:]mm:ss on Unix like systems.
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
index 9a2de65..41badfd 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
@@ -55,7 +55,7 @@ public class ProviderFactory
private static final Class[] INVOKE_EMPTY_PARAMETER_TYPES = { };
- private static final Class[] INVOKE_EMPTY_PARAMETERS = { };
+ private static final Object[] INVOKE_EMPTY_PARAMETERS = { };
public ProviderFactory( StartupConfiguration startupConfiguration, ProviderConfiguration providerConfiguration,
ClassLoader testsClassLoader, Object reporterManagerFactory )
@@ -152,7 +152,7 @@ public class ProviderFactory
@Override
public RunResult invoke( Object forkTestSet )
- throws TestSetFailedException, ReporterException, InvocationTargetException
+ throws ReporterException, InvocationTargetException
{
ClassLoader current = swapClassLoader( testsClassLoader );
try
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
index c8df291..abed5e8 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
@@ -44,21 +44,17 @@ public class SystemPropertyManager
public static PropertiesWrapper loadProperties( InputStream inStream )
throws IOException
{
- try
+ try ( final InputStream stream = inStream )
{
Properties p = new Properties();
- p.load( inStream );
- Map<String, String> map = new ConcurrentHashMap<String, String>( p.size() );
+ p.load( stream );
+ Map<String, String> map = new ConcurrentHashMap<>( p.size() );
for ( String key : p.stringPropertyNames() )
{
map.put( key, p.getProperty( key ) );
}
return new PropertiesWrapper( map );
}
- finally
- {
- close( inStream ); // @todo use try-with-resources JDK7, search in all code
- }
}
private static PropertiesWrapper loadProperties( File file )
@@ -92,34 +88,9 @@ public class SystemPropertyManager
public static void writePropertiesFile( File file, String name, Properties properties )
throws IOException
{
- FileOutputStream out = new FileOutputStream( file );
-
- try
+ try ( FileOutputStream out = new FileOutputStream( file ) )
{
properties.store( out, name );
}
- finally
- {
- out.close();
- }
}
-
- public static void close( InputStream inputStream )
- {
- if ( inputStream == null )
- {
- return;
- }
-
- try
- {
- inputStream.close();
- }
- catch ( IOException ex )
- {
- // ignore
- }
- }
-
-
}
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
index 9cb0ef9..e8223d7 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemUtils.java
@@ -35,7 +35,7 @@ import java.util.StringTokenizer;
import static java.lang.Character.isDigit;
import static java.lang.Thread.currentThread;
-import static org.apache.commons.io.IOUtils.closeQuietly;
+import static java.util.Objects.requireNonNull;
import static org.apache.commons.lang3.StringUtils.isNumeric;
import static org.apache.commons.lang3.SystemUtils.IS_OS_FREE_BSD;
import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
@@ -43,7 +43,6 @@ import static org.apache.commons.lang3.SystemUtils.IS_OS_NET_BSD;
import static org.apache.commons.lang3.SystemUtils.IS_OS_OPEN_BSD;
import static org.apache.maven.surefire.util.ReflectionUtils.invokeMethodChain;
import static org.apache.maven.surefire.util.ReflectionUtils.tryLoadClass;
-import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
/**
* JDK 9 support.
@@ -55,8 +54,6 @@ public final class SystemUtils
{
public static final BigDecimal JAVA_SPECIFICATION_VERSION = getJavaSpecificationVersion();
- private static final BigDecimal JAVA_VERSION_7 = new BigDecimal( "1.7" ).stripTrailingZeros();
-
private static final BigDecimal JIGSAW_JAVA_VERSION = new BigDecimal( 9 ).stripTrailingZeros();
private static final int PROC_STATUS_PID_FIRST_CHARS = 20;
@@ -137,11 +134,9 @@ public final class SystemUtils
{
return null;
}
- InputStream is = null;
- try
+ Properties properties = new Properties();
+ try ( InputStream is = new FileInputStream( release ) )
{
- Properties properties = new Properties();
- is = new FileInputStream( release );
properties.load( is );
String javaVersion = properties.getProperty( "JAVA_VERSION" ).replace( "\"", "" );
StringTokenizer versions = new StringTokenizer( javaVersion, "._" );
@@ -167,10 +162,6 @@ public final class SystemUtils
{
return null;
}
- finally
- {
- closeQuietly( is );
- }
}
/**
@@ -231,11 +222,6 @@ public final class SystemUtils
return JAVA_SPECIFICATION_VERSION.compareTo( JIGSAW_JAVA_VERSION ) >= 0;
}
- public static boolean isBuiltInJava7AtLeast()
- {
- return JAVA_SPECIFICATION_VERSION.compareTo( JAVA_VERSION_7 ) >= 0;
- }
-
public static boolean isJava9AtLeast( BigDecimal version )
{
return version != null && version.compareTo( JIGSAW_JAVA_VERSION ) >= 0;
@@ -336,8 +322,7 @@ public final class SystemUtils
*/
static Long pidStatusOnLinux( String root ) throws Exception
{
- FileReader input = new FileReader( root + "/proc/self/stat" );
- try
+ try ( FileReader input = new FileReader( root + "/proc/self/stat" ) )
{
// Reading and encoding 20 characters is bit faster than whole line.
// size of (long) = 19, + 1 space
@@ -345,10 +330,6 @@ public final class SystemUtils
String startLine = new String( buffer, 0, input.read( buffer ) );
return Long.parseLong( startLine.substring( 0, startLine.indexOf( ' ' ) ) );
}
- finally
- {
- input.close();
- }
}
/**
@@ -383,18 +364,13 @@ public final class SystemUtils
*/
static Long pidStatusOnBSD( String root ) throws Exception
{
- BufferedReader input = new BufferedReader( new FileReader( root + "/proc/curproc/status" ) );
- try
+ try ( BufferedReader input = new BufferedReader( new FileReader( root + "/proc/curproc/status" ) ) )
{
String line = input.readLine();
int i1 = 1 + line.indexOf( ' ' );
int i2 = line.indexOf( ' ', i1 );
return Long.parseLong( line.substring( i1, i2 ) );
}
- finally
- {
- input.close();
- }
}
static Long pidOnJava9()
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
index 00ad2e9..95365d8 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/TypeEncodedValue.java
@@ -24,8 +24,8 @@ import java.io.File;
import java.io.IOException;
import java.util.Properties;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static org.apache.maven.surefire.util.ReflectionUtils.loadClass;
-import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
/**
* @author Kristian Rosenvold
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
index 78a180b..cb0679e 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/ClasspathTest.java
@@ -39,7 +39,6 @@ public class ClasspathTest
private static final String DUMMY_URL_2 = "bar.jar";
public void testShouldWriteEmptyPropertyForEmptyClasspath()
- throws Exception
{
Classpath classpath = Classpath.emptyClasspath();
classpath.writeToSystemProperty( DUMMY_PROPERTY_NAME );
@@ -47,7 +46,6 @@ public class ClasspathTest
}
public void testShouldWriteSeparatedElementsAsSystemProperty()
- throws Exception
{
Classpath classpath = Classpath.emptyClasspath().addClassPathElementUrl( DUMMY_URL_1 ).addClassPathElementUrl( DUMMY_URL_2 );
classpath.writeToSystemProperty( DUMMY_PROPERTY_NAME );
@@ -62,15 +60,6 @@ public class ClasspathTest
assertClasspathConsistsOfElements( classpath, new String[]{ DUMMY_URL_1 } );
}
- public void testGetAsUrlList()
- throws Exception
- {
- final List asUrlList = createClasspathWithTwoElements().getAsUrlList();
- assertEquals( 2, asUrlList.size() );
- assertTrue( asUrlList.get( 0 ).toString().endsWith( DUMMY_URL_1 ) );
- assertTrue( asUrlList.get( 1 ).toString().endsWith( DUMMY_URL_2 ) );
- }
-
public void testShouldJoinTwoNullClasspaths()
{
Classpath joinedClasspath = Classpath.join( null, null );
@@ -78,7 +67,6 @@ public class ClasspathTest
}
public void testShouldHaveAllElementsAfterJoiningTwoDifferentClasspaths()
- throws Exception
{
Classpath firstClasspath = Classpath.emptyClasspath();
Classpath secondClasspath = firstClasspath.addClassPathElementUrl( DUMMY_URL_1 ).addClassPathElementUrl( DUMMY_URL_2 );
@@ -87,7 +75,6 @@ public class ClasspathTest
}
public void testShouldNotHaveDuplicatesAfterJoiningTowClasspathsWithEqualElements()
- throws Exception
{
Classpath firstClasspath = Classpath.emptyClasspath().addClassPathElementUrl( DUMMY_URL_1 );
Classpath secondClasspath = Classpath.emptyClasspath().addClassPathElementUrl( DUMMY_URL_1 );
@@ -96,7 +83,6 @@ public class ClasspathTest
}
public void testShouldNotBeAbleToRemoveElement()
- throws Exception
{
try
{
@@ -132,7 +118,6 @@ public class ClasspathTest
}
public void testShouldThrowIllegalArgumentExceptionWhenNullIsAddedAsClassPathElementUrl()
- throws Exception
{
Classpath classpath = Classpath.emptyClasspath();
try
@@ -146,7 +131,6 @@ public class ClasspathTest
}
public void testShouldNotAddNullAsClassPathElementUrl()
- throws Exception
{
Classpath classpath = Classpath.emptyClasspath();
try
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/CommandReaderTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/CommandReaderTest.java
index ccc33d5..740b46d 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/CommandReaderTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/CommandReaderTest.java
@@ -29,7 +29,6 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -40,7 +39,8 @@ import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -57,7 +57,7 @@ import static org.fest.assertions.Assertions.assertThat;
@RunWith( NewClassLoaderRunner.class )
public class CommandReaderTest
{
- private final BlockingQueue<Byte> blockingStream = new LinkedBlockingQueue<Byte>();
+ private final BlockingQueue<Byte> blockingStream = new LinkedBlockingQueue<>();
private InputStream realInputStream;
private CommandReader reader;
@@ -75,7 +75,6 @@ public class CommandReaderTest
@Before
public void init()
- throws UnsupportedEncodingException
{
Thread.interrupted();
realInputStream = System.in;
@@ -92,7 +91,7 @@ public class CommandReaderTest
}
@Test
- public void readJustOneClass() throws Exception
+ public void readJustOneClass()
{
Iterator<String> it = reader.getIterableClasses( nul() ).iterator();
assertTrue( it.hasNext() );
@@ -111,7 +110,7 @@ public class CommandReaderTest
}
@Test
- public void manyClasses() throws Exception
+ public void manyClasses()
{
Iterator<String> it1 = reader.getIterableClasses( nul() ).iterator();
assertThat( it1.next(), is( getClass().getName() ) );
@@ -167,7 +166,7 @@ public class CommandReaderTest
assertThat( it.next(), is( CommandReaderTest.class.getName() ) );
}
};
- FutureTask<Object> futureTask = new FutureTask<Object>( runnable, null );
+ FutureTask<Object> futureTask = new FutureTask<>( runnable, null );
Thread t = new Thread( futureTask );
reader.stop();
t.start();
@@ -197,7 +196,7 @@ public class CommandReaderTest
assertThat( it.next(), is( PropertiesWrapperTest.class.getName() ) );
}
};
- FutureTask<Object> futureTask = new FutureTask<Object>( runnable, null );
+ FutureTask<Object> futureTask = new FutureTask<>( runnable, null );
Thread t = new Thread( futureTask );
t.start();
counter.await();
@@ -240,7 +239,6 @@ public class CommandReaderTest
}
private void addTestToPipeline( String cls )
- throws UnsupportedEncodingException
{
byte[] clazz = cls.getBytes( ISO_8859_1 );
ByteBuffer buffer = ByteBuffer.allocate( 8 + clazz.length )
@@ -255,7 +253,6 @@ public class CommandReaderTest
}
private void addEndOfPipeline()
- throws UnsupportedEncodingException
{
ByteBuffer buffer = ByteBuffer.allocate( 8 )
.putInt( MasterProcessCommand.TEST_SET_FINISHED.getId() )
diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
index dd2f271..0f5188c 100644
--- a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
+++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/SurefireReflectorTest.java
@@ -146,19 +146,9 @@ public class SurefireReflectorTest
isCalled = foo.getClass().getMethod( "isCalled" );
return (Boolean) isCalled.invoke( foo );
}
- catch ( IllegalAccessException e )
- {
- throw new RuntimeException( e );
- }
- catch ( InvocationTargetException e )
- {
- throw new RuntimeException( e );
- }
- catch ( NoSuchMethodException e )
+ catch ( ReflectiveOperationException e )
{
throw new RuntimeException( e );
}
}
-
-
}
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
index 6695301..646869a 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java
@@ -81,9 +81,10 @@ public abstract class AbstractJigsawIT
+ EXT_JDK_HOME + File.separator + "release", release.exists() );
Properties properties = new Properties();
- InputStream is = new FileInputStream( release );
- properties.load( is );
- is.close();
+ try ( InputStream is = new FileInputStream( release ) )
+ {
+ properties.load( is );
+ }
String javaVersion = properties.getProperty( "JAVA_VERSION" ).replace( "\"", "" );
StringTokenizer versions = new StringTokenizer( javaVersion, "._" );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java
index 9fe1775..628d63e 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java
@@ -19,11 +19,8 @@ package org.apache.maven.surefire.its;
* under the License.
*/
-import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
-
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
-import org.junit.Before;
import org.junit.Test;
/**
@@ -37,12 +34,6 @@ import org.junit.Test;
public class JUnit47RerunFailingTestWithCucumberIT
extends SurefireJUnit4IntegrationTestCase {
- @Before
- public void assumeJdk17() {
- assumeJavaVersion(1.7d);
- }
-
-
private SurefireLauncher unpack() {
return unpack("junit47-rerun-failing-tests-with-cucumber")
.setJUnitVersion("4.12");
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
index 38c2eae..4b99df5 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java
@@ -20,11 +20,8 @@ package org.apache.maven.surefire.its;
*/
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
-import org.junit.Before;
import org.junit.Test;
-import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
-
/**
* Tests the JUnit 47 provider with the cucumber runner. At the moment, they don't play along that perfectly (minor
* glitches in the reports with parallel=classes), but at least all tests are executed, the execution times are counted
@@ -37,12 +34,6 @@ public class JUnit47WithCucumberIT
extends SurefireJUnit4IntegrationTestCase
{
- @Before
- public void assumeJdk16()
- {
- assumeJavaVersion( 1.6d );
- }
-
@Test
public void testWithoutParallel()
{
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
index 7800f4b..174ed1a 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
@@ -112,9 +112,10 @@ public class WorkingDirectoryIT
final TestFile outFile = getOutFile( childTestDir );
assertTrue( "out.txt doesn't exist: " + outFile.getAbsolutePath(), outFile.exists() );
Properties p = new Properties();
- FileInputStream is = outFile.getFileInputStream();
- p.load( is );
- is.close();
+ try ( FileInputStream is = outFile.getFileInputStream() )
+ {
+ p.load( is );
+ }
String userDirPath = p.getProperty( "user.dir" );
assertNotNull( "user.dir was null in property file", userDirPath );
File userDir = new File( userDirPath );
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
index cc942ad..29e8038 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
@@ -102,23 +102,19 @@ public class TestFile
public String slurpFile()
{
- try
+ StringBuilder sb = new StringBuilder();
+ try ( BufferedReader reader = new BufferedReader( new FileReader( file ) ) )
{
- StringBuilder sb = new StringBuilder();
- BufferedReader reader;
- reader = new BufferedReader( new FileReader( file ) );
for ( String line = reader.readLine(); line != null; line = reader.readLine() )
{
sb.append( line );
}
- reader.close();
return sb.toString();
}
catch ( IOException e )
{
throw new SurefireVerifierException( e );
}
-
}
public String readFileToString()
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
index 28cc78c..d24801c 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1177TestngParallelSuitesIT.java
@@ -25,7 +25,6 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
import org.junit.Test;
-import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;
@@ -46,8 +45,6 @@ public class Surefire1177TestngParallelSuitesIT
public void twoSuitesInParallel()
throws VerificationException
{
- assumeJavaVersion( 1.7d );
-
OutputValidator validator = unpack()
.forkMode( "never" )
.executeTest()
@@ -63,8 +60,6 @@ public class Surefire1177TestngParallelSuitesIT
public void twoSuitesInParallelForked()
throws VerificationException
{
- assumeJavaVersion( 1.7d );
-
OutputValidator validator = unpack()
.forkMode( "once" )
.executeTest()
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
index 53cd764..698df57 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1211JUnitTestNgIT.java
@@ -23,8 +23,6 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
import org.apache.maven.surefire.its.fixture.SurefireLauncher;
import org.junit.Test;
-import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
-
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
* @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-1211">SUREFIRE-1211</a>
@@ -37,8 +35,6 @@ public class Surefire1211JUnitTestNgIT
@Test
public void withJUnit()
{
- assumeJavaVersion( 1.7d );
-
unpack().threadCount( 1 )
.executeTest()
.verifyErrorFree( 2 );
@@ -47,8 +43,6 @@ public class Surefire1211JUnitTestNgIT
@Test
public void withoutJUnit()
{
- assumeJavaVersion( 1.7d );
-
unpack().threadCount( 1 )
.sysProp( "junit", "false" )
.executeTest()
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
index 6dd1ecd..b4c2678 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire260TestWithIdenticalNamesIT.java
@@ -58,8 +58,7 @@ public class Surefire260TestWithIdenticalNamesIT
TestFile siteFile = validator.getSiteFile( "surefire-report.html" );
final URI uri = siteFile.toURI();
- WebClient webClient = new WebClient();
- try
+ try ( WebClient webClient = new WebClient() )
{
HtmlPage page = webClient.getPage( uri.toURL() );
HtmlAnchor a = ( HtmlAnchor ) page.getByXPath(
@@ -71,9 +70,5 @@ public class Surefire260TestWithIdenticalNamesIT
a.click();
assertFalse( content.getAttribute( "style" ).contains( "none" ) );
}
- finally
- {
- webClient.close();
- }
}
}
diff --git a/surefire-its/src/test/resources/environment-variables/pom.xml b/surefire-its/src/test/resources/environment-variables/pom.xml
index 6b8e3bc..902e97e 100644
--- a/surefire-its/src/test/resources/environment-variables/pom.xml
+++ b/surefire-its/src/test/resources/environment-variables/pom.xml
@@ -31,8 +31,8 @@
<properties>
<forkMode>always</forkMode>
<useSystemClassLoader>false</useSystemClassLoader>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/failingBuilds/pom.xml b/surefire-its/src/test/resources/failingBuilds/pom.xml
index d30dbb3..8e988ad 100644
--- a/surefire-its/src/test/resources/failingBuilds/pom.xml
+++ b/surefire-its/src/test/resources/failingBuilds/pom.xml
@@ -34,7 +34,7 @@
<properties>
<junit.version>4.8.1</junit.version>
<forkMode>once</forkMode>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/failsafe-notests/pom.xml b/surefire-its/src/test/resources/failsafe-notests/pom.xml
index b6d29b9..24d1dec 100644
--- a/surefire-its/src/test/resources/failsafe-notests/pom.xml
+++ b/surefire-its/src/test/resources/failsafe-notests/pom.xml
@@ -28,8 +28,8 @@
<name>failsafe-notests</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/failure-result-counting/pom.xml b/surefire-its/src/test/resources/failure-result-counting/pom.xml
index 9d6ae84..7d79f29 100644
--- a/surefire-its/src/test/resources/failure-result-counting/pom.xml
+++ b/surefire-its/src/test/resources/failure-result-counting/pom.xml
@@ -32,7 +32,7 @@
<properties>
<junit.version>4.10</junit.version>
<forkMode>once</forkMode>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/failureOutput/pom.xml b/surefire-its/src/test/resources/failureOutput/pom.xml
index e6ad639..85c10ee 100644
--- a/surefire-its/src/test/resources/failureOutput/pom.xml
+++ b/surefire-its/src/test/resources/failureOutput/pom.xml
@@ -43,8 +43,8 @@
<printSummary>true</printSummary>
<useFile>true</useFile>
<reportFormat>brief</reportFormat>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/fork-consoleOutput/pom.xml b/surefire-its/src/test/resources/fork-consoleOutput/pom.xml
index 1c89877..407d86b 100644
--- a/surefire-its/src/test/resources/fork-consoleOutput/pom.xml
+++ b/surefire-its/src/test/resources/fork-consoleOutput/pom.xml
@@ -40,8 +40,8 @@
<forkMode>once</forkMode>
<printSummary>true</printSummary>
<reportFormat>brief</reportFormat>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml
index 5f3af23..9aa5e1b 100644
--- a/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml
+++ b/surefire-its/src/test/resources/fork-consoleOutputWithErrors/pom.xml
@@ -43,8 +43,8 @@
<printSummary>true</printSummary>
<useFile>true</useFile>
<reportFormat>brief</reportFormat>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/fork-fail/pom.xml b/surefire-its/src/test/resources/fork-fail/pom.xml
index 8825613..9db6d72 100644
--- a/surefire-its/src/test/resources/fork-fail/pom.xml
+++ b/surefire-its/src/test/resources/fork-fail/pom.xml
@@ -30,8 +30,8 @@
<properties>
<argLine>-Xmxxxx712743m</argLine>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java
index 8c09af6..1f41d4e 100644
--- a/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-fail/src/test/java/forkMode/Test1.java
@@ -46,13 +46,12 @@ public class Test1
target = new File( "." );
}
File pidFile = new File( target, fileName );
- FileWriter fw = new FileWriter( pidFile );
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.flush();
- fw.close();
+ try ( FileWriter fw = new FileWriter( pidFile ) )
+ {
+ // DGF little known trick... this is guaranteed to be unique to the PID
+ // In fact, it usually contains the pid and the local host name!
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ }
}
-
}
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
index 7497816..ed3dd57 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-a/src/test/java/forkMode/Test1.java
@@ -51,17 +51,15 @@ public class Test1
target = new File( "." );
}
File pidFile = new File( target, fileName );
- FileWriter fw = new FileWriter( pidFile );
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.write( " " );
- fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
- fw.flush();
- fw.close();
- System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
+ try ( FileWriter fw = new FileWriter( pidFile ) )
+ {
+ // DGF little known trick... this is guaranteed to be unique to the PID
+ // In fact, it usually contains the pid and the local host name!
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ fw.write( " " );
+ fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
+ System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
+ }
}
-
-
}
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java
index 7497816..ed3dd57 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java
@@ -51,17 +51,15 @@ public class Test1
target = new File( "." );
}
File pidFile = new File( target, fileName );
- FileWriter fw = new FileWriter( pidFile );
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.write( " " );
- fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
- fw.flush();
- fw.close();
- System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
+ try ( FileWriter fw = new FileWriter( pidFile ) )
+ {
+ // DGF little known trick... this is guaranteed to be unique to the PID
+ // In fact, it usually contains the pid and the local host name!
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ fw.write( " " );
+ fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
+ System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
+ }
}
-
-
}
diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml b/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml
index 708598c..e0786b1 100644
--- a/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml
+++ b/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml
@@ -31,8 +31,8 @@
<packaging>pom</packaging>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<modules>
diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml b/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml
index 21a0fc2..e40033c 100644
--- a/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml
+++ b/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml
@@ -29,8 +29,8 @@
<name>Test for forkMode</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/fork-mode-testng/pom.xml b/surefire-its/src/test/resources/fork-mode-testng/pom.xml
index 1f1956b..8e25749 100644
--- a/surefire-its/src/test/resources/fork-mode-testng/pom.xml
+++ b/surefire-its/src/test/resources/fork-mode-testng/pom.xml
@@ -13,8 +13,8 @@
<name>Test for forkMode</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java
index 8caec4e..9c13d2c 100644
--- a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java
@@ -51,15 +51,14 @@ public class Test1
target = new File( "." );
}
File pidFile = new File( target, fileName );
- FileWriter fw = new FileWriter( pidFile );
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.write( " " );
- fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
- fw.flush();
- fw.close();
+ try ( FileWriter fw = new FileWriter( pidFile ) )
+ {
+ // DGF little known trick... this is guaranteed to be unique to the PID
+ // In fact, it usually contains the pid and the local host name!
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ fw.write( " " );
+ fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
+ }
}
-
}
diff --git a/surefire-its/src/test/resources/fork-mode/pom.xml b/surefire-its/src/test/resources/fork-mode/pom.xml
index ad9ec47..28bfb4d 100644
--- a/surefire-its/src/test/resources/fork-mode/pom.xml
+++ b/surefire-its/src/test/resources/fork-mode/pom.xml
@@ -29,8 +29,8 @@
<name>Test for forkMode</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
index 5588106..cd02aca 100644
--- a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java
@@ -55,17 +55,16 @@ public class Test1
{
pidFile.delete();
}
- FileWriter fw = new FileWriter( pidFile );
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.write( " " );
- fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
- fw.flush();
- fw.close();
- System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
- }
-
+ try ( FileWriter fw = new FileWriter( pidFile ) )
+ {
+ // DGF little known trick... this is guaranteed to be unique to the PID
+ // In fact, it usually contains the pid and the local host name!
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ fw.write( " " );
+ fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) );
+ System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() );
+ }
+ }
}
diff --git a/surefire-its/src/test/resources/fork-timeout/pom.xml b/surefire-its/src/test/resources/fork-timeout/pom.xml
index 67d85e9..25365a2 100644
--- a/surefire-its/src/test/resources/fork-timeout/pom.xml
+++ b/surefire-its/src/test/resources/fork-timeout/pom.xml
@@ -12,8 +12,8 @@
<junit.parallel>classes</junit.parallel>
<forkMode>once</forkMode>
<timeOut>1</timeOut>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml b/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml
index d69c129..39313db 100644
--- a/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml
+++ b/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml
@@ -31,8 +31,8 @@ under the License.
<properties>
<junit.version>3.8.2</junit.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java
index be6a6bb..4fd7296 100644
--- a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java
+++ b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java
@@ -26,9 +26,9 @@ public class DefaultTest
public void testRun()
throws Exception
{
- FileOutputStream fout = new FileOutputStream( "target/defaultTestTouchFile.txt" );
- fout.write( '!' );
- fout.flush();
- fout.close();
+ try ( FileOutputStream fout = new FileOutputStream( "target/defaultTestTouchFile.txt" ) )
+ {
+ fout.write( '!' );
+ }
}
}
diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java
index 58b962a..80c64f8 100644
--- a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java
+++ b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java
@@ -26,9 +26,9 @@ public class NotIncludedByDefault
public void testRun()
throws Exception
{
- FileOutputStream fout = new FileOutputStream( "target/testTouchFile.txt" );
- fout.write( '!' );
- fout.flush();
- fout.close();
+ try ( FileOutputStream fout = new FileOutputStream( "target/testTouchFile.txt" ) )
+ {
+ fout.write( '!' );
+ }
}
}
diff --git a/surefire-its/src/test/resources/includes-excludes/pom.xml b/surefire-its/src/test/resources/includes-excludes/pom.xml
index f107168..77711f7 100644
--- a/surefire-its/src/test/resources/includes-excludes/pom.xml
+++ b/surefire-its/src/test/resources/includes-excludes/pom.xml
@@ -31,8 +31,8 @@ under the License.
<properties>
<junit.version>3.8.2</junit.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java
index be6a6bb..4fd7296 100644
--- a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java
+++ b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java
@@ -26,9 +26,9 @@ public class DefaultTest
public void testRun()
throws Exception
{
- FileOutputStream fout = new FileOutputStream( "target/defaultTestTouchFile.txt" );
- fout.write( '!' );
- fout.flush();
- fout.close();
+ try ( FileOutputStream fout = new FileOutputStream( "target/defaultTestTouchFile.txt" ) )
+ {
+ fout.write( '!' );
+ }
}
}
diff --git a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java
index 58b962a..80c64f8 100644
--- a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java
+++ b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java
@@ -26,9 +26,9 @@ public class NotIncludedByDefault
public void testRun()
throws Exception
{
- FileOutputStream fout = new FileOutputStream( "target/testTouchFile.txt" );
- fout.write( '!' );
- fout.flush();
- fout.close();
+ try ( FileOutputStream fout = new FileOutputStream( "target/testTouchFile.txt" ) )
+ {
+ fout.write( '!' );
+ }
}
}
diff --git a/surefire-its/src/test/resources/isolated-classloader/pom.xml b/surefire-its/src/test/resources/isolated-classloader/pom.xml
index e761141..a853063 100644
--- a/surefire-its/src/test/resources/isolated-classloader/pom.xml
+++ b/surefire-its/src/test/resources/isolated-classloader/pom.xml
@@ -29,8 +29,8 @@
<name>Test for useSystemClassLoader=false</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml b/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml
index 8b48b46..9b86c75 100644
--- a/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml
+++ b/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml
@@ -29,8 +29,8 @@
<name>Test for forkMode</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java b/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java
index d206283..d56d697 100644
--- a/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java
+++ b/surefire-its/src/test/resources/junit-fork-mode-always/src/test/java/junit4/forkMode/Test1.java
@@ -46,15 +46,13 @@ public class Test1
target = new File( "." );
}
File pidFile = new File( target, fileName );
- FileWriter fw = new FileWriter( pidFile );
- // DGF little known trick... this is guaranteed to be unique to the PID
- // In fact, it usually contains the pid and the local host name!
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.flush();
- fw.close();
-
- System.out.println( "pid = " + pid );
+ try ( FileWriter fw = new FileWriter( pidFile ) )
+ {
+ // DGF little known trick... this is guaranteed to be unique to the PID
+ // In fact, it usually contains the pid and the local host name!
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ System.out.println( "pid = " + pid );
+ }
}
-
}
diff --git a/surefire-its/src/test/resources/junit-ignore/pom.xml b/surefire-its/src/test/resources/junit-ignore/pom.xml
index a9547fc..d9c3817 100644
--- a/surefire-its/src/test/resources/junit-ignore/pom.xml
+++ b/surefire-its/src/test/resources/junit-ignore/pom.xml
@@ -32,8 +32,8 @@
<junit.version>4.4</junit.version>
<surefire.parallel></surefire.parallel>
<surefire.threadcount>3</surefire.threadcount>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit-innerClass/pom.xml b/surefire-its/src/test/resources/junit-innerClass/pom.xml
index ac98523..fb1ffd6 100644
--- a/surefire-its/src/test/resources/junit-innerClass/pom.xml
+++ b/surefire-its/src/test/resources/junit-innerClass/pom.xml
@@ -29,8 +29,8 @@
<name>Test JUnit classes with inner classes</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit-notExtendingTestCase/pom.xml b/surefire-its/src/test/resources/junit-notExtendingTestCase/pom.xml
index 3a05cf1..8a95201 100644
--- a/surefire-its/src/test/resources/junit-notExtendingTestCase/pom.xml
+++ b/surefire-its/src/test/resources/junit-notExtendingTestCase/pom.xml
@@ -29,8 +29,8 @@
<name>Test for JUnit tests that don't extend TestCase</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit-pathWithUmlaut/pom.xml b/surefire-its/src/test/resources/junit-pathWithUmlaut/pom.xml
index 9f947e0..ee65491 100644
--- a/surefire-its/src/test/resources/junit-pathWithUmlaut/pom.xml
+++ b/surefire-its/src/test/resources/junit-pathWithUmlaut/pom.xml
@@ -29,8 +29,8 @@
<name>Test path with Ümlaut</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit-twoTestCaseSuite/pom.xml b/surefire-its/src/test/resources/junit-twoTestCaseSuite/pom.xml
index ce121c7..f2075ae 100644
--- a/surefire-its/src/test/resources/junit-twoTestCaseSuite/pom.xml
+++ b/surefire-its/src/test/resources/junit-twoTestCaseSuite/pom.xml
@@ -29,8 +29,8 @@
<name>Test for single suite with two test cases</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/junit-twoTestCases/pom.xml b/surefire-its/src/test/resources/junit-twoTestCases/pom.xml
index 51ad8b2..89684ad 100644
--- a/surefire-its/src/test/resources/junit-twoTestCases/pom.xml
+++ b/surefire-its/src/test/resources/junit-twoTestCases/pom.xml
@@ -24,8 +24,8 @@
<modelVersion>4.0.0</modelVersion>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<groupId>org.apache.maven.plugins.surefire</groupId>
diff --git a/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml b/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml
index 77ce5c4..4bfc081 100644
--- a/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml
+++ b/surefire-its/src/test/resources/junit4-forkAlways-staticInit/pom.xml
@@ -11,8 +11,8 @@
</description>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit4-rerun-failing-tests/pom.xml b/surefire-its/src/test/resources/junit4-rerun-failing-tests/pom.xml
index 1bf63c7..9456a29 100644
--- a/surefire-its/src/test/resources/junit4-rerun-failing-tests/pom.xml
+++ b/surefire-its/src/test/resources/junit4-rerun-failing-tests/pom.xml
@@ -29,8 +29,8 @@
<name>Test for rerun failing tests in JUnit 4</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit4-runlistener/pom.xml b/surefire-its/src/test/resources/junit4-runlistener/pom.xml
index ff22b91..d776533 100644
--- a/surefire-its/src/test/resources/junit4-runlistener/pom.xml
+++ b/surefire-its/src/test/resources/junit4-runlistener/pom.xml
@@ -31,8 +31,8 @@
<properties>
<junitVersion>4.4</junitVersion>
<provider>surefire-junit4</provider>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit4-runlistener/src/test/java/runListener/FileHelper.java b/surefire-its/src/test/resources/junit4-runlistener/src/test/java/runListener/FileHelper.java
index 85d0a5b..5387390 100644
--- a/surefire-its/src/test/resources/junit4-runlistener/src/test/java/runListener/FileHelper.java
+++ b/surefire-its/src/test/resources/junit4-runlistener/src/test/java/runListener/FileHelper.java
@@ -31,10 +31,10 @@ public class FileHelper
{
File target = new File( "target" ).getAbsoluteFile();
File listenerOutput = new File( target, fileName );
- FileWriter out = new FileWriter( listenerOutput );
- out.write( content );
- out.flush();
- out.close();
+ try ( FileWriter out = new FileWriter( listenerOutput ) )
+ {
+ out.write( content );
+ }
}
catch ( IOException e )
{
diff --git a/surefire-its/src/test/resources/junit4-twoTestCaseSuite/pom.xml b/surefire-its/src/test/resources/junit4-twoTestCaseSuite/pom.xml
index 5836224..867cd09 100644
--- a/surefire-its/src/test/resources/junit4-twoTestCaseSuite/pom.xml
+++ b/surefire-its/src/test/resources/junit4-twoTestCaseSuite/pom.xml
@@ -31,8 +31,8 @@
<properties>
<junitVersion>4.4</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit44-dep/pom.xml b/surefire-its/src/test/resources/junit44-dep/pom.xml
index bae6ad6..d26c024 100644
--- a/surefire-its/src/test/resources/junit44-dep/pom.xml
+++ b/surefire-its/src/test/resources/junit44-dep/pom.xml
@@ -29,8 +29,8 @@
<name>Test for junit-dep</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit44-environment/pom.xml b/surefire-its/src/test/resources/junit44-environment/pom.xml
index af18c21..eb04443 100644
--- a/surefire-its/src/test/resources/junit44-environment/pom.xml
+++ b/surefire-its/src/test/resources/junit44-environment/pom.xml
@@ -29,8 +29,8 @@
<name>Test for setting environment variables</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit44-hamcrest/pom.xml b/surefire-its/src/test/resources/junit44-hamcrest/pom.xml
index c5e44ab..4140b41 100644
--- a/surefire-its/src/test/resources/junit44-hamcrest/pom.xml
+++ b/surefire-its/src/test/resources/junit44-hamcrest/pom.xml
@@ -29,8 +29,8 @@
<name>Test for JUnit44 with Hamcrest extensions</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit44-method-pattern/pom.xml b/surefire-its/src/test/resources/junit44-method-pattern/pom.xml
index 3ed4b2a..e9ac59e 100644
--- a/surefire-its/src/test/resources/junit44-method-pattern/pom.xml
+++ b/surefire-its/src/test/resources/junit44-method-pattern/pom.xml
@@ -31,8 +31,8 @@
<properties>
<junitVersion>4.4</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit44-single-method/pom.xml b/surefire-its/src/test/resources/junit44-single-method/pom.xml
index 26769be..c74aee2 100644
--- a/surefire-its/src/test/resources/junit44-single-method/pom.xml
+++ b/surefire-its/src/test/resources/junit44-single-method/pom.xml
@@ -31,8 +31,8 @@
<properties>
<junitVersion>4.4</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit47-parallel-with-suite/pom.xml b/surefire-its/src/test/resources/junit47-parallel-with-suite/pom.xml
index c8aa695..5dcbaba 100644
--- a/surefire-its/src/test/resources/junit47-parallel-with-suite/pom.xml
+++ b/surefire-its/src/test/resources/junit47-parallel-with-suite/pom.xml
@@ -16,8 +16,8 @@
</dependencies>
<properties>
<parallel>methods</parallel>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
diff --git a/surefire-its/src/test/resources/junit47-redirect-output/pom.xml b/surefire-its/src/test/resources/junit47-redirect-output/pom.xml
index a4b9066..38ec727 100644
--- a/surefire-its/src/test/resources/junit47-redirect-output/pom.xml
+++ b/surefire-its/src/test/resources/junit47-redirect-output/pom.xml
@@ -51,8 +51,8 @@
<forkMode>once</forkMode>
<printSummary>true</printSummary>
<parallel>none</parallel>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml b/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml
index b0c40ec..81f26c2 100644
--- a/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml
+++ b/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml
@@ -8,8 +8,8 @@
<name>junit47-static-inner-class-tests</name>
<url>http://maven.apache.org</url>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/junit48-categories/pom.xml b/surefire-its/src/test/resources/junit48-categories/pom.xml
index 4fcf119..a83b687 100644
--- a/surefire-its/src/test/resources/junit48-categories/pom.xml
+++ b/surefire-its/src/test/resources/junit48-categories/pom.xml
@@ -33,8 +33,8 @@
<junit.version>4.8.1</junit.version>
<groups>junit4.CategoryA,junit4.CategoryB</groups>
<excludedGroups></excludedGroups>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/junit48-smartStackTrace/pom.xml b/surefire-its/src/test/resources/junit48-smartStackTrace/pom.xml
index 84a3a18..fe104a4 100644
--- a/surefire-its/src/test/resources/junit48-smartStackTrace/pom.xml
+++ b/surefire-its/src/test/resources/junit48-smartStackTrace/pom.xml
@@ -31,8 +31,8 @@
<properties>
<junitVersion>4.8.1</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/norunnableTests/pom.xml b/surefire-its/src/test/resources/norunnableTests/pom.xml
index f9e154f..dd1a3cc 100644
--- a/surefire-its/src/test/resources/norunnableTests/pom.xml
+++ b/surefire-its/src/test/resources/norunnableTests/pom.xml
@@ -29,8 +29,8 @@
<name>Test JUnit classes with inner classes</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/parallel-runtime/pom.xml b/surefire-its/src/test/resources/parallel-runtime/pom.xml
index 34ba2fe..f39f949 100644
--- a/surefire-its/src/test/resources/parallel-runtime/pom.xml
+++ b/surefire-its/src/test/resources/parallel-runtime/pom.xml
@@ -18,8 +18,8 @@
<properties>
<parallel>classes</parallel>
<threadCount>3</threadCount>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/plain-old-java-classpath/pom.xml b/surefire-its/src/test/resources/plain-old-java-classpath/pom.xml
index 042bdd1..72bd38c 100644
--- a/surefire-its/src/test/resources/plain-old-java-classpath/pom.xml
+++ b/surefire-its/src/test/resources/plain-old-java-classpath/pom.xml
@@ -29,8 +29,8 @@
<name>Test for useManifestOnlyJar=false</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/plexus-conflict/pom.xml b/surefire-its/src/test/resources/plexus-conflict/pom.xml
index 5cb6d81..338904a 100644
--- a/surefire-its/src/test/resources/plexus-conflict/pom.xml
+++ b/surefire-its/src/test/resources/plexus-conflict/pom.xml
@@ -29,8 +29,8 @@
<name>Test for plexus conflict</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/pojo-simple/pom.xml b/surefire-its/src/test/resources/pojo-simple/pom.xml
index d418dc4..45986ac 100644
--- a/surefire-its/src/test/resources/pojo-simple/pom.xml
+++ b/surefire-its/src/test/resources/pojo-simple/pom.xml
@@ -29,8 +29,8 @@
<name>Pojo simple test</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<!-- NOTE: This has no dependencies on JUnit or TestNG, just nothing -->
diff --git a/surefire-its/src/test/resources/pom.xml b/surefire-its/src/test/resources/pom.xml
index 929385c..e01ed4c 100644
--- a/surefire-its/src/test/resources/pom.xml
+++ b/surefire-its/src/test/resources/pom.xml
@@ -9,8 +9,8 @@
<name>It parent</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/reporters/pom.xml b/surefire-its/src/test/resources/reporters/pom.xml
index 82d0b54..2152525 100644
--- a/surefire-its/src/test/resources/reporters/pom.xml
+++ b/surefire-its/src/test/resources/reporters/pom.xml
@@ -43,7 +43,7 @@
<redirect.to.file>true</redirect.to.file>
<forkMode>once</forkMode>
<printSummary>true</printSummary>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/result-counting/pom.xml b/surefire-its/src/test/resources/result-counting/pom.xml
index 5147bf1..fcb7372 100644
--- a/surefire-its/src/test/resources/result-counting/pom.xml
+++ b/surefire-its/src/test/resources/result-counting/pom.xml
@@ -35,7 +35,7 @@
<properties>
<junit.version>4.8.1</junit.version>
<forkMode>once</forkMode>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/runOrder/pom.xml b/surefire-its/src/test/resources/runOrder/pom.xml
index 0544e70..84abb53 100644
--- a/surefire-its/src/test/resources/runOrder/pom.xml
+++ b/surefire-its/src/test/resources/runOrder/pom.xml
@@ -29,8 +29,8 @@
<name>Test for runOrder</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/runorder-parallel/pom.xml b/surefire-its/src/test/resources/runorder-parallel/pom.xml
index d2f38b6..1dee7d8 100644
--- a/surefire-its/src/test/resources/runorder-parallel/pom.xml
+++ b/surefire-its/src/test/resources/runorder-parallel/pom.xml
@@ -16,8 +16,8 @@
</dependencies>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/sibling-aggregator/aggregator/pom.xml b/surefire-its/src/test/resources/sibling-aggregator/aggregator/pom.xml
index 36dff80..b12b118 100644
--- a/surefire-its/src/test/resources/sibling-aggregator/aggregator/pom.xml
+++ b/surefire-its/src/test/resources/sibling-aggregator/aggregator/pom.xml
@@ -30,8 +30,8 @@
<packaging>pom</packaging>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<modules>
diff --git a/surefire-its/src/test/resources/sibling-aggregator/child1/pom.xml b/surefire-its/src/test/resources/sibling-aggregator/child1/pom.xml
index 9ed3e9b..be2f9df 100644
--- a/surefire-its/src/test/resources/sibling-aggregator/child1/pom.xml
+++ b/surefire-its/src/test/resources/sibling-aggregator/child1/pom.xml
@@ -29,8 +29,8 @@
<name>Test for aggregated child1</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/sibling-aggregator/child2/pom.xml b/surefire-its/src/test/resources/sibling-aggregator/child2/pom.xml
index 1312a3d..b8c21bf 100644
--- a/surefire-its/src/test/resources/sibling-aggregator/child2/pom.xml
+++ b/surefire-its/src/test/resources/sibling-aggregator/child2/pom.xml
@@ -29,8 +29,8 @@
<name>Test for aggregated child2</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/small-result-counting/pom.xml b/surefire-its/src/test/resources/small-result-counting/pom.xml
index fb6c175..e06061c 100644
--- a/surefire-its/src/test/resources/small-result-counting/pom.xml
+++ b/surefire-its/src/test/resources/small-result-counting/pom.xml
@@ -32,7 +32,7 @@
<properties>
<junit.version>4.8.1</junit.version>
<forkMode>once</forkMode>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/surefire-1024/jiras-surefire-1024-testjar/pom.xml b/surefire-its/src/test/resources/surefire-1024/jiras-surefire-1024-testjar/pom.xml
index 61b0668..5bf2bad 100644
--- a/surefire-its/src/test/resources/surefire-1024/jiras-surefire-1024-testjar/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1024/jiras-surefire-1024-testjar/pom.xml
@@ -32,8 +32,8 @@
<version>1.0</version>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1080-parallel-fork-double-test/pom.xml b/surefire-its/src/test/resources/surefire-1080-parallel-fork-double-test/pom.xml
index 96adf0c..2f24bc4 100644
--- a/surefire-its/src/test/resources/surefire-1080-parallel-fork-double-test/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1080-parallel-fork-double-test/pom.xml
@@ -45,8 +45,8 @@
</contributors>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1082-parallel-junit-parameterized/pom.xml b/surefire-its/src/test/resources/surefire-1082-parallel-junit-parameterized/pom.xml
index 226023d..4229cc9 100644
--- a/surefire-its/src/test/resources/surefire-1082-parallel-junit-parameterized/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1082-parallel-junit-parameterized/pom.xml
@@ -40,8 +40,8 @@
</developers>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml b/surefire-its/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml
index b5570fd..6bc1c31 100644
--- a/surefire-its/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml
@@ -26,8 +26,8 @@
<version>1.0</version>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml b/surefire-its/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml
index e58abdc..daecfc0 100644
--- a/surefire-its/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1135-improve-ignore-message-for-testng/pom.xml
@@ -30,8 +30,8 @@
<name>Surefire 1135</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml b/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml
index bdccd8b..4fb9d72 100644
--- a/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1202-rerun-and-failfast/pom.xml
@@ -41,8 +41,8 @@
</developers>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml b/surefire-its/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml
index 8a0fdf9..9bb5c27 100644
--- a/surefire-its/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml
@@ -41,8 +41,8 @@
</developers>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1278-group-name-ending/pom.xml b/surefire-its/src/test/resources/surefire-1278-group-name-ending/pom.xml
index 399d601..d262525 100644
--- a/surefire-its/src/test/resources/surefire-1278-group-name-ending/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1278-group-name-ending/pom.xml
@@ -29,8 +29,8 @@
<name>Test for testng groups</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath-provider/pom.xml b/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath-provider/pom.xml
index c8bd26f..30e5199 100644
--- a/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath-provider/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath-provider/pom.xml
@@ -27,8 +27,8 @@
<name>Test provider</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath/pom.xml b/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath/pom.xml
index 642737c..be5cf97 100644
--- a/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1396-pluggableproviders-classpath/pom.xml
@@ -29,8 +29,8 @@
<name>pluggableproviders-classpath-test</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml b/surefire-its/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml
index 76b7636..10a40c4 100644
--- a/surefire-its/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml
+++ b/surefire-its/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml
@@ -27,8 +27,8 @@
<name>Test provider</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-141-pluggableproviders/pom.xml b/surefire-its/src/test/resources/surefire-141-pluggableproviders/pom.xml
index 5e1e054..1a92a0c 100644
--- a/surefire-its/src/test/resources/surefire-141-pluggableproviders/pom.xml
+++ b/surefire-its/src/test/resources/surefire-141-pluggableproviders/pom.xml
@@ -39,8 +39,8 @@
<properties>
<surefire.version>2.12.4</surefire.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml b/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml
index 424a016..671a654 100644
--- a/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml
+++ b/surefire-its/src/test/resources/surefire-146-forkPerTestNoSetup/pom.xml
@@ -29,8 +29,8 @@
<name>Test for SUREFIRE-146 (forkMode=pertest fails to call setUp)</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-1535-parallel-testng/pom.xml b/surefire-its/src/test/resources/surefire-1535-parallel-testng/pom.xml
index c7aba88..4fcc715 100644
--- a/surefire-its/src/test/resources/surefire-1535-parallel-testng/pom.xml
+++ b/surefire-its/src/test/resources/surefire-1535-parallel-testng/pom.xml
@@ -29,8 +29,8 @@
<name>Test execution testng suites in parallel</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml b/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml
index 948b323..3eb6175 100644
--- a/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml
+++ b/surefire-its/src/test/resources/surefire-162-charsetProvider/pom.xml
@@ -6,8 +6,8 @@
<name>Test alternate CharsetProvider</name>
<version>1.0-SNAPSHOT</version>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
diff --git a/surefire-its/src/test/resources/surefire-224-wellFormedXmlFailures/pom.xml b/surefire-its/src/test/resources/surefire-224-wellFormedXmlFailures/pom.xml
index 944ccaf..74217ef 100644
--- a/surefire-its/src/test/resources/surefire-224-wellFormedXmlFailures/pom.xml
+++ b/surefire-its/src/test/resources/surefire-224-wellFormedXmlFailures/pom.xml
@@ -29,8 +29,8 @@
<name>Test for MSUREFIRE-54 (well-formed XML failures)</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-257-rerunningTests/pom.xml b/surefire-its/src/test/resources/surefire-257-rerunningTests/pom.xml
index 4b30546..c3e6738 100644
--- a/surefire-its/src/test/resources/surefire-257-rerunningTests/pom.xml
+++ b/surefire-its/src/test/resources/surefire-257-rerunningTests/pom.xml
@@ -8,8 +8,8 @@
<packaging>pom</packaging>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml b/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml
index bdb9d6f..4bb71da 100644
--- a/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml
+++ b/surefire-its/src/test/resources/surefire-260-testWithIdenticalNames/pom.xml
@@ -29,8 +29,8 @@
<name>surefire-260-testsWithIdenticalNames</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-34-securityManager-success/pom.xml b/surefire-its/src/test/resources/surefire-34-securityManager-success/pom.xml
index af205c6..541f499 100644
--- a/surefire-its/src/test/resources/surefire-34-securityManager-success/pom.xml
+++ b/surefire-its/src/test/resources/surefire-34-securityManager-success/pom.xml
@@ -30,8 +30,8 @@
<properties>
<junitVersion>3.8.1</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-34-securityManager/pom.xml b/surefire-its/src/test/resources/surefire-34-securityManager/pom.xml
index af205c6..541f499 100644
--- a/surefire-its/src/test/resources/surefire-34-securityManager/pom.xml
+++ b/surefire-its/src/test/resources/surefire-34-securityManager/pom.xml
@@ -30,8 +30,8 @@
<properties>
<junitVersion>3.8.1</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-408-manual-provider-selection/pom.xml b/surefire-its/src/test/resources/surefire-408-manual-provider-selection/pom.xml
index 8579532..ac94779 100644
--- a/surefire-its/src/test/resources/surefire-408-manual-provider-selection/pom.xml
+++ b/surefire-its/src/test/resources/surefire-408-manual-provider-selection/pom.xml
@@ -29,8 +29,8 @@
<name>Test for two test cases</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-500-puzzling-error/pom.xml b/surefire-its/src/test/resources/surefire-500-puzzling-error/pom.xml
index 33bd9a5..ce01272 100644
--- a/surefire-its/src/test/resources/surefire-500-puzzling-error/pom.xml
+++ b/surefire-its/src/test/resources/surefire-500-puzzling-error/pom.xml
@@ -9,8 +9,8 @@
<url>http://maven.apache.org</url>
<properties>
<junit.version>4.4</junit.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml b/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml
index 24916fa..5cb7b92 100644
--- a/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml
+++ b/surefire-its/src/test/resources/surefire-510-testClassPath/pom.xml
@@ -29,8 +29,8 @@
<name>Surefire-510-systemprops</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml b/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml
index 9efe896..b3238ea 100644
--- a/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml
+++ b/surefire-its/src/test/resources/surefire-570-multipleReportDirectories/pom.xml
@@ -8,8 +8,8 @@
<packaging>pom</packaging>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml b/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
index daba45e..8175d3f 100644
--- a/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
+++ b/surefire-its/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
@@ -8,8 +8,8 @@
<name>junit4-test</name>
<url>http://maven.apache.org</url>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml b/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
index a012b7f..412035d 100644
--- a/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
+++ b/surefire-its/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
@@ -9,8 +9,8 @@
<url>http://maven.apache.org</url>
<properties>
<junit.version>4.8.1</junit.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml b/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
index cd89dd1..9c975a8 100644
--- a/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
+++ b/surefire-its/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
@@ -10,8 +10,8 @@
<properties>
<junit.version>4.8.1</junit.version>
<parallel>methods</parallel>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml b/surefire-its/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
index 06a6162..211a99d 100644
--- a/surefire-its/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
+++ b/surefire-its/src/test/resources/surefire-634-systemPropertiesWarning/pom.xml
@@ -30,8 +30,8 @@
<properties>
<junitVersion>4.4</junitVersion>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-673-mockito/pom.xml b/surefire-its/src/test/resources/surefire-673-mockito/pom.xml
index f73c533..0b03c13 100644
--- a/surefire-its/src/test/resources/surefire-673-mockito/pom.xml
+++ b/surefire-its/src/test/resources/surefire-673-mockito/pom.xml
@@ -7,8 +7,8 @@
<version>1.0.0-SNAPSHOT</version>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml b/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
index 4631a8c..398a225 100644
--- a/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
+++ b/surefire-its/src/test/resources/surefire-674-buildFailingWhenErrors/pom.xml
@@ -35,7 +35,7 @@
<properties>
<junit.version>4.8.1</junit.version>
<forkMode>once</forkMode>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml b/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml
index 567901e..eb40366 100644
--- a/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml
+++ b/surefire-its/src/test/resources/surefire-685-commaseparatedIncludes/pom.xml
@@ -29,8 +29,8 @@
<name>surefire-685-commaseparatedIncludes</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-697-niceSummary/pom.xml b/surefire-its/src/test/resources/surefire-697-niceSummary/pom.xml
index d86467b..52663e5 100644
--- a/surefire-its/src/test/resources/surefire-697-niceSummary/pom.xml
+++ b/surefire-its/src/test/resources/surefire-697-niceSummary/pom.xml
@@ -29,8 +29,8 @@
<name>Tests summary with long/multiline exception messages</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-733-allOverridesCaptured/pom.xml b/surefire-its/src/test/resources/surefire-733-allOverridesCaptured/pom.xml
index 4ed3472..acb0d5e 100644
--- a/surefire-its/src/test/resources/surefire-733-allOverridesCaptured/pom.xml
+++ b/surefire-its/src/test/resources/surefire-733-allOverridesCaptured/pom.xml
@@ -50,7 +50,7 @@
<properties>
<junit.version>4.8.1</junit.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/pom.xml b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/pom.xml
index cdf4de2..9c039d4 100644
--- a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/pom.xml
+++ b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/pom.xml
@@ -11,8 +11,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/FailingTest.java b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/FailingTest.java
index a4d0cd3..8a0da3c 100644
--- a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/FailingTest.java
+++ b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/FailingTest.java
@@ -60,25 +60,9 @@ public class FailingTest
final File f = new File( "target/tests-run", getClass().getName() + ".txt" );
f.getParentFile().mkdirs();
- FileWriter w = null;
-
- try
+ try ( FileWriter w = new FileWriter( f, true ) )
{
- w = new FileWriter( f, true );
w.write( name.getMethodName() );
}
- finally
- {
- if ( w != null )
- {
- try
- {
- w.close();
- }
- catch ( final IOException e )
- {
- }
- }
- }
}
}
diff --git a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/SucceedingTest.java b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/SucceedingTest.java
index c9167c1..3078c61 100644
--- a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/SucceedingTest.java
+++ b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-failureInFirst/src/test/java/org/apache/maven/surefire/test/SucceedingTest.java
@@ -59,26 +59,9 @@ public class SucceedingTest
{
final File f = new File( "target/tests-run", getClass().getName() + ".txt" );
f.getParentFile().mkdirs();
-
- FileWriter w = null;
-
- try
+ try ( FileWriter w = new FileWriter( f, true ) )
{
- w = new FileWriter( f, true );
w.write( name.getMethodName() );
}
- finally
- {
- if ( w != null )
- {
- try
- {
- w.close();
- }
- catch ( final IOException e )
- {
- }
- }
- }
}
}
diff --git a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-rebuildOverwrites/pom.xml b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-rebuildOverwrites/pom.xml
index 78aa765..ae8ad78 100644
--- a/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-rebuildOverwrites/pom.xml
+++ b/surefire-its/src/test/resources/surefire-803-multiFailsafeExec-rebuildOverwrites/pom.xml
@@ -11,8 +11,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-806-specifiedTests-multi/pom.xml b/surefire-its/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
index dd4090d..296ded6 100644
--- a/surefire-its/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
+++ b/surefire-its/src/test/resources/surefire-806-specifiedTests-multi/pom.xml
@@ -29,8 +29,8 @@
<name>Test for single test in one of multiple executions</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-806-specifiedTests-single/pom.xml b/surefire-its/src/test/resources/surefire-806-specifiedTests-single/pom.xml
index 617446b..74e261a 100644
--- a/surefire-its/src/test/resources/surefire-806-specifiedTests-single/pom.xml
+++ b/surefire-its/src/test/resources/surefire-806-specifiedTests-single/pom.xml
@@ -29,8 +29,8 @@
<name>Test for single test in one of multiple executions</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-809-groupExpr-junit48/pom.xml b/surefire-its/src/test/resources/surefire-809-groupExpr-junit48/pom.xml
index ff49c39..30f1708 100644
--- a/surefire-its/src/test/resources/surefire-809-groupExpr-junit48/pom.xml
+++ b/surefire-its/src/test/resources/surefire-809-groupExpr-junit48/pom.xml
@@ -31,8 +31,8 @@
<properties>
<junit.version>4.8.1</junit.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-809-groupExpr-testng/pom.xml b/surefire-its/src/test/resources/surefire-809-groupExpr-testng/pom.xml
index 5c39211..983e5bb 100644
--- a/surefire-its/src/test/resources/surefire-809-groupExpr-testng/pom.xml
+++ b/surefire-its/src/test/resources/surefire-809-groupExpr-testng/pom.xml
@@ -30,8 +30,8 @@
<properties>
<groups>!CategoryC</groups>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
diff --git a/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml b/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml
index c24eb50..61be350 100644
--- a/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml
+++ b/surefire-its/src/test/resources/surefire-812-log4j-classloader/pom.xml
@@ -7,8 +7,8 @@
<version>1.0.0-SNAPSHOT</version>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-818-ignored-tests-on-npe/pom.xml b/surefire-its/src/test/resources/surefire-818-ignored-tests-on-npe/pom.xml
index 683327b..cef444e 100644
--- a/surefire-its/src/test/resources/surefire-818-ignored-tests-on-npe/pom.xml
+++ b/surefire-its/src/test/resources/surefire-818-ignored-tests-on-npe/pom.xml
@@ -7,8 +7,8 @@
<name>cyril</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-junit48/pom.xml b/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-junit48/pom.xml
index 5f64d10..2d005b6 100644
--- a/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-junit48/pom.xml
+++ b/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-junit48/pom.xml
@@ -32,8 +32,8 @@
<properties>
<junitVersion>4.8.1</junitVersion>
<groups>junit4.CategoryA,junit4.CategoryB</groups>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-testng/pom.xml b/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-testng/pom.xml
index 67ea160..989f8af 100644
--- a/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-testng/pom.xml
+++ b/surefire-its/src/test/resources/surefire-828-emptyGroupExpr-testng/pom.xml
@@ -19,8 +19,8 @@
<name>TestNG group expressions tests</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-832-provider-selection/pom.xml b/surefire-its/src/test/resources/surefire-832-provider-selection/pom.xml
index f2dbec0..895dd91 100644
--- a/surefire-its/src/test/resources/surefire-832-provider-selection/pom.xml
+++ b/surefire-its/src/test/resources/surefire-832-provider-selection/pom.xml
@@ -32,8 +32,8 @@
<properties>
<junitVersion>4.8.1</junitVersion>
<groups>junit4.CategoryA,junit4.CategoryB</groups>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-847-testngfail/pom.xml b/surefire-its/src/test/resources/surefire-847-testngfail/pom.xml
index 511ea6b..18cb679 100644
--- a/surefire-its/src/test/resources/surefire-847-testngfail/pom.xml
+++ b/surefire-its/src/test/resources/surefire-847-testngfail/pom.xml
@@ -54,7 +54,7 @@
</build>
<properties>
<defaultSuiteFile>${basedir}/src/test/resources/suite.xml</defaultSuiteFile>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/src/test/java/jiras/surefre855/bundle/FooIT.java b/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/src/test/java/jiras/surefre855/bundle/FooIT.java
index e5cbffa..bf508d6 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/src/test/java/jiras/surefre855/bundle/FooIT.java
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-bundle/src/test/java/jiras/surefre855/bundle/FooIT.java
@@ -95,26 +95,22 @@ public final class FooIT
File booter = new File( System.getProperty( "surefire.real.class.path" ) );
assertThat( booter ).exists();
assertThat( booter ).isFile();
- JarFile jarFile = new JarFile( booter );
- try
+ try ( JarFile jarFile = new JarFile( booter ) )
{
Manifest manifest = jarFile.getManifest();
return manifest.getMainAttributes().getValue( "Class-Path" );
}
- finally
- {
- jarFile.close();
- }
}
private static Properties loadProperties( Class clazz, String resourcePath )
throws IOException
{
- InputStream is = clazz.getResourceAsStream( resourcePath );
- Properties prop = new Properties();
- prop.load( is );
- is.close();
- return prop;
+ try ( InputStream is = clazz.getResourceAsStream( resourcePath ) )
+ {
+ Properties prop = new Properties();
+ prop.load( is );
+ return prop;
+ }
}
private static Properties loadMainProperties( Class clazz )
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java b/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java
index 39b8749..516ea29 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-jar/src/test/java/jiras/surefire855/jar/FooIT.java
@@ -96,26 +96,22 @@ public final class FooIT
File booter = new File( System.getProperty( "surefire.real.class.path" ) );
assertThat( booter ).exists();
assertThat( booter ).isFile();
- JarFile jarFile = new JarFile( booter );
- try
+ try ( JarFile jarFile = new JarFile( booter ) )
{
Manifest manifest = jarFile.getManifest();
return manifest.getMainAttributes().getValue( "Class-Path" );
}
- finally
- {
- jarFile.close();
- }
}
private static Properties loadProperties( Class clazz, String resourcePath )
throws IOException
{
- InputStream is = clazz.getResourceAsStream( resourcePath );
- Properties prop = new Properties();
- prop.load( is );
- is.close();
- return prop;
+ try ( InputStream is = clazz.getResourceAsStream( resourcePath ) )
+ {
+ Properties prop = new Properties();
+ prop.load( is );
+ return prop;
+ }
}
private static Properties loadMainProperties( Class clazz )
diff --git a/surefire-its/src/test/resources/surefire-855-failsafe-use-war/src/test/java/jiras/surefire855/war/FooIT.java b/surefire-its/src/test/resources/surefire-855-failsafe-use-war/src/test/java/jiras/surefire855/war/FooIT.java
index 95eb8c3..1741dfe 100644
--- a/surefire-its/src/test/resources/surefire-855-failsafe-use-war/src/test/java/jiras/surefire855/war/FooIT.java
+++ b/surefire-its/src/test/resources/surefire-855-failsafe-use-war/src/test/java/jiras/surefire855/war/FooIT.java
@@ -93,26 +93,22 @@ public final class FooIT
File booter = new File( System.getProperty( "surefire.real.class.path" ) );
assertThat( booter ).exists();
assertThat( booter ).isFile();
- JarFile jarFile = new JarFile( booter );
- try
+ try ( JarFile jarFile = new JarFile( booter ) )
{
Manifest manifest = jarFile.getManifest();
return manifest.getMainAttributes().getValue( "Class-Path" );
}
- finally
- {
- jarFile.close();
- }
}
private static Properties loadProperties( Class clazz, String resourcePath )
throws IOException
{
- InputStream is = clazz.getResourceAsStream( resourcePath );
- Properties prop = new Properties();
- prop.load( is );
- is.close();
- return prop;
+ try ( InputStream is = clazz.getResourceAsStream( resourcePath ) )
+ {
+ Properties prop = new Properties();
+ prop.load( is );
+ return prop;
+ }
}
private static Properties loadMainProperties( Class clazz )
diff --git a/surefire-its/src/test/resources/surefire-930-failsafe-runtests/pom.xml b/surefire-its/src/test/resources/surefire-930-failsafe-runtests/pom.xml
index bc20362..8535068 100644
--- a/surefire-its/src/test/resources/surefire-930-failsafe-runtests/pom.xml
+++ b/surefire-its/src/test/resources/surefire-930-failsafe-runtests/pom.xml
@@ -11,8 +11,8 @@
<properties>
<surefire.version>2.12.4</surefire.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/surefire-931-provider-failure/pom.xml b/surefire-its/src/test/resources/surefire-931-provider-failure/pom.xml
index b866def..6232149 100644
--- a/surefire-its/src/test/resources/surefire-931-provider-failure/pom.xml
+++ b/surefire-its/src/test/resources/surefire-931-provider-failure/pom.xml
@@ -12,8 +12,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
diff --git a/surefire-its/src/test/resources/surefire-943-report-content/pom.xml b/surefire-its/src/test/resources/surefire-943-report-content/pom.xml
index 13e8403..3b2958f 100644
--- a/surefire-its/src/test/resources/surefire-943-report-content/pom.xml
+++ b/surefire-its/src/test/resources/surefire-943-report-content/pom.xml
@@ -10,8 +10,8 @@
<properties>
<surefire.version>2.13</surefire.version>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/surefire-946-killMainProcessInReusableFork/pom.xml b/surefire-its/src/test/resources/surefire-946-killMainProcessInReusableFork/pom.xml
index 83e3870..53bb0a3 100644
--- a/surefire-its/src/test/resources/surefire-946-killMainProcessInReusableFork/pom.xml
+++ b/surefire-its/src/test/resources/surefire-946-killMainProcessInReusableFork/pom.xml
@@ -27,8 +27,8 @@
<name>Tests killing the main maven process when using reusable forks</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-946-self-destruct-plugin/pom.xml b/surefire-its/src/test/resources/surefire-946-self-destruct-plugin/pom.xml
index 005eb4f..811be93 100644
--- a/surefire-its/src/test/resources/surefire-946-self-destruct-plugin/pom.xml
+++ b/surefire-its/src/test/resources/surefire-946-self-destruct-plugin/pom.xml
@@ -12,8 +12,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/pom.xml b/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/pom.xml
index 220f37b..7a2ac4d 100644
--- a/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/pom.xml
+++ b/surefire-its/src/test/resources/surefire-972-bizarre-noclassdef/pom.xml
@@ -10,8 +10,8 @@
<module>boom</module>
</modules>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<pluginManagement>
diff --git a/surefire-its/src/test/resources/surefire-975-wrong-encoding/pom.xml b/surefire-its/src/test/resources/surefire-975-wrong-encoding/pom.xml
index 571809f..49848d6 100755
--- a/surefire-its/src/test/resources/surefire-975-wrong-encoding/pom.xml
+++ b/surefire-its/src/test/resources/surefire-975-wrong-encoding/pom.xml
@@ -9,8 +9,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module1/pom.xml b/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module1/pom.xml
index e0c7477..79e1c7d 100644
--- a/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module1/pom.xml
+++ b/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module1/pom.xml
@@ -7,8 +7,8 @@
<name>surefire-979-base</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module2/pom.xml b/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module2/pom.xml
index e8ef424..cae9147 100644
--- a/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module2/pom.xml
+++ b/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/module2/pom.xml
@@ -7,8 +7,8 @@
<name>surefire-979</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/pom.xml b/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/pom.xml
index 9a4c595..c9c1f91 100644
--- a/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/pom.xml
+++ b/surefire-its/src/test/resources/surefire-979-smartStackTrace-wrongClassloader/pom.xml
@@ -13,8 +13,8 @@
</modules>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/system-properties/pom.xml b/surefire-its/src/test/resources/system-properties/pom.xml
index 79899b5..1d2952d 100644
--- a/surefire-its/src/test/resources/system-properties/pom.xml
+++ b/surefire-its/src/test/resources/system-properties/pom.xml
@@ -91,8 +91,8 @@
<properties>
<setOnArgLineWorkAround>fool</setOnArgLineWorkAround>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
</project>
diff --git a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml
index e893fec..28cf17d 100644
--- a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml
+++ b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/pom.xml
@@ -12,8 +12,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/src/main/java/org/apache/maven/plugins/surefire/dumppid/DumpPidMojo.java b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/src/main/java/org/apache/maven/plugins/surefire/dumppid/DumpPidMojo.java
index 035976b..f083f29 100644
--- a/surefire-its/src/test/resources/test-helper-dump-pid-plugin/src/main/java/org/apache/maven/plugins/surefire/dumppid/DumpPidMojo.java
+++ b/surefire-its/src/test/resources/test-helper-dump-pid-plugin/src/main/java/org/apache/maven/plugins/surefire/dumppid/DumpPidMojo.java
@@ -41,7 +41,6 @@ public class DumpPidMojo
public void execute()
throws MojoExecutionException
{
- File target;
try
{
getLog().info( "Dumping PID to " + targetDir );
@@ -51,16 +50,14 @@ public class DumpPidMojo
targetDir.mkdirs();
}
- target = new File( targetDir, "maven.pid" ).getCanonicalFile();
+ File target = new File( targetDir, "maven.pid" ).getCanonicalFile();
- FileWriter fw = new FileWriter( target );
- String pid = ManagementFactory.getRuntimeMXBean().getName();
- fw.write( pid );
- fw.flush();
- fw.close();
-
- getLog().info( "Wrote " + pid + " to " + target );
-
+ try ( FileWriter fw = new FileWriter( target ) )
+ {
+ String pid = ManagementFactory.getRuntimeMXBean().getName();
+ fw.write( pid );
+ getLog().info( "Wrote " + pid + " to " + target );
+ }
}
catch ( IOException e )
{
diff --git a/surefire-its/src/test/resources/testng-afterSuiteFailure/pom.xml b/surefire-its/src/test/resources/testng-afterSuiteFailure/pom.xml
index 3958c79..0b96853 100644
--- a/surefire-its/src/test/resources/testng-afterSuiteFailure/pom.xml
+++ b/surefire-its/src/test/resources/testng-afterSuiteFailure/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG failure after suite</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-beforeMethod/pom.xml b/surefire-its/src/test/resources/testng-beforeMethod/pom.xml
index 63f3445..1072958 100644
--- a/surefire-its/src/test/resources/testng-beforeMethod/pom.xml
+++ b/surefire-its/src/test/resources/testng-beforeMethod/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG @BeforeMethod annotation</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-beforeMethodFailure/pom.xml b/surefire-its/src/test/resources/testng-beforeMethodFailure/pom.xml
index 6e8ee65..88b6a4e 100644
--- a/surefire-its/src/test/resources/testng-beforeMethodFailure/pom.xml
+++ b/surefire-its/src/test/resources/testng-beforeMethodFailure/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG failure in @BeforeMethod annotation</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-execute-error/pom.xml b/surefire-its/src/test/resources/testng-execute-error/pom.xml
index a140357..7e06dbe 100644
--- a/surefire-its/src/test/resources/testng-execute-error/pom.xml
+++ b/surefire-its/src/test/resources/testng-execute-error/pom.xml
@@ -29,8 +29,8 @@
<name>Test proper output from forked execution in case of uncatched error during suite run</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-groups/pom.xml b/surefire-its/src/test/resources/testng-groups/pom.xml
index f26929e..f6b7447 100644
--- a/surefire-its/src/test/resources/testng-groups/pom.xml
+++ b/surefire-its/src/test/resources/testng-groups/pom.xml
@@ -29,8 +29,8 @@
<name>Test for testng groups</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/testng-jdk14/pom.xml b/surefire-its/src/test/resources/testng-jdk14/pom.xml
index 2098e7d..337f71c 100644
--- a/surefire-its/src/test/resources/testng-jdk14/pom.xml
+++ b/surefire-its/src/test/resources/testng-jdk14/pom.xml
@@ -29,8 +29,8 @@
<name>Test for testng jdk14 integration</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/testng-junit-together/pom.xml b/surefire-its/src/test/resources/testng-junit-together/pom.xml
index f8d0b20..93c9942 100644
--- a/surefire-its/src/test/resources/testng-junit-together/pom.xml
+++ b/surefire-its/src/test/resources/testng-junit-together/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG and Junit Together</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-listener-reporter/pom.xml b/surefire-its/src/test/resources/testng-listener-reporter/pom.xml
index 3fed89f..af6ac28 100644
--- a/surefire-its/src/test/resources/testng-listener-reporter/pom.xml
+++ b/surefire-its/src/test/resources/testng-listener-reporter/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG listener and reporter test</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-listener-reporter/src/test/java/listenReport/FileHelper.java b/surefire-its/src/test/resources/testng-listener-reporter/src/test/java/listenReport/FileHelper.java
index 6a6688a..291adb4 100644
--- a/surefire-its/src/test/resources/testng-listener-reporter/src/test/java/listenReport/FileHelper.java
+++ b/surefire-its/src/test/resources/testng-listener-reporter/src/test/java/listenReport/FileHelper.java
@@ -31,14 +31,14 @@ public class FileHelper
{
File target = new File( "target" ).getAbsoluteFile();
File listenerOutput = new File( target, fileName );
- FileWriter out = new FileWriter(listenerOutput);
- out.write( content );
- out.flush();
- out.close();
+ try ( FileWriter out = new FileWriter( listenerOutput ) )
+ {
+ out.write( content );
+ }
}
catch ( IOException e )
{
- throw new RuntimeException(e);
+ throw new RuntimeException( e );
}
}
}
diff --git a/surefire-its/src/test/resources/testng-method-pattern-after/pom.xml b/surefire-its/src/test/resources/testng-method-pattern-after/pom.xml
index fac74ae..41768cd 100644
--- a/surefire-its/src/test/resources/testng-method-pattern-after/pom.xml
+++ b/surefire-its/src/test/resources/testng-method-pattern-after/pom.xml
@@ -29,8 +29,8 @@
<name>Test for Testng</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-method-pattern-before/pom.xml b/surefire-its/src/test/resources/testng-method-pattern-before/pom.xml
index fac74ae..41768cd 100644
--- a/surefire-its/src/test/resources/testng-method-pattern-before/pom.xml
+++ b/surefire-its/src/test/resources/testng-method-pattern-before/pom.xml
@@ -29,8 +29,8 @@
<name>Test for Testng</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-method-pattern/pom.xml b/surefire-its/src/test/resources/testng-method-pattern/pom.xml
index fb627b7..50b08bf 100644
--- a/surefire-its/src/test/resources/testng-method-pattern/pom.xml
+++ b/surefire-its/src/test/resources/testng-method-pattern/pom.xml
@@ -29,8 +29,8 @@
<name>Test for Testng</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-objectFactory/src/test/java/testng/objectfactory/FileHelper.java b/surefire-its/src/test/resources/testng-objectFactory/src/test/java/testng/objectfactory/FileHelper.java
index 4db30b6..3d1bab5 100644
--- a/surefire-its/src/test/resources/testng-objectFactory/src/test/java/testng/objectfactory/FileHelper.java
+++ b/surefire-its/src/test/resources/testng-objectFactory/src/test/java/testng/objectfactory/FileHelper.java
@@ -10,16 +10,16 @@ public class FileHelper
{
try
{
- File target = new File( System.getProperty("user.dir"), "target" ).getCanonicalFile();
+ File target = new File( System.getProperty( "user.dir" ), "target" ).getCanonicalFile();
File listenerOutput = new File( target, fileName );
- FileWriter out = new FileWriter( listenerOutput, true );
- out.write( content );
- out.flush();
- out.close();
+ try (FileWriter out = new FileWriter( listenerOutput, true ) )
+ {
+ out.write( content );
+ }
}
- catch ( IOException exception )
+ catch ( IOException e )
{
- throw new RuntimeException( exception );
+ throw new RuntimeException( e );
}
}
}
diff --git a/surefire-its/src/test/resources/testng-parallel-with-annotations/pom.xml b/surefire-its/src/test/resources/testng-parallel-with-annotations/pom.xml
index ed45863..9464c84 100644
--- a/surefire-its/src/test/resources/testng-parallel-with-annotations/pom.xml
+++ b/surefire-its/src/test/resources/testng-parallel-with-annotations/pom.xml
@@ -18,8 +18,8 @@
<version>1.0-SNAPSHOT</version>
<name>TestNG group/parallel thread tests, with parallel settings set by @Test(threadPoolSize)</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/testng-path with spaces/pom.xml b/surefire-its/src/test/resources/testng-path with spaces/pom.xml
index cedd92d..3f1138a 100644
--- a/surefire-its/src/test/resources/testng-path with spaces/pom.xml
+++ b/surefire-its/src/test/resources/testng-path with spaces/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG test in a path with spaces</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-simple/pom.xml b/surefire-its/src/test/resources/testng-simple/pom.xml
index 7ab3904..d361ddc 100644
--- a/surefire-its/src/test/resources/testng-simple/pom.xml
+++ b/surefire-its/src/test/resources/testng-simple/pom.xml
@@ -76,8 +76,8 @@
<surefire.testng.verbose>0</surefire.testng.verbose>
<argLine/>
<jacoco.agent/>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/testng-single-method-5-14-9/pom.xml b/surefire-its/src/test/resources/testng-single-method-5-14-9/pom.xml
index b7629d5..a10bd0f 100644
--- a/surefire-its/src/test/resources/testng-single-method-5-14-9/pom.xml
+++ b/surefire-its/src/test/resources/testng-single-method-5-14-9/pom.xml
@@ -29,8 +29,8 @@
<name>Test for Testng</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/testng-single-method/pom.xml b/surefire-its/src/test/resources/testng-single-method/pom.xml
index 330ffcb..32ebfaf 100644
--- a/surefire-its/src/test/resources/testng-single-method/pom.xml
+++ b/surefire-its/src/test/resources/testng-single-method/pom.xml
@@ -29,8 +29,8 @@
<name>Test for Testng</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-suite-xml/pom.xml b/surefire-its/src/test/resources/testng-suite-xml/pom.xml
index b0af8b8..ec02455 100644
--- a/surefire-its/src/test/resources/testng-suite-xml/pom.xml
+++ b/surefire-its/src/test/resources/testng-suite-xml/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG Suite XML File</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java b/surefire-its/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java
index 4b998ed..225cb8a 100644
--- a/surefire-its/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java
+++ b/surefire-its/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java
@@ -10,16 +10,16 @@ public class FileHelper
{
try
{
- File target = new File( System.getProperty("user.dir"), "target" ).getCanonicalFile();
+ File target = new File( System.getProperty( "user.dir" ), "target" ).getCanonicalFile();
File listenerOutput = new File( target, fileName );
- FileWriter out = new FileWriter( listenerOutput, true );
- out.write( content );
- out.flush();
- out.close();
+ try ( FileWriter out = new FileWriter( listenerOutput, true ) )
+ {
+ out.write( content );
+ }
}
- catch ( IOException exception )
+ catch ( IOException e )
{
- throw new RuntimeException( exception );
+ throw new RuntimeException( e );
}
}
}
diff --git a/surefire-its/src/test/resources/testng-twoTestCaseSuite/pom.xml b/surefire-its/src/test/resources/testng-twoTestCaseSuite/pom.xml
index 0293192..f7477fe 100644
--- a/surefire-its/src/test/resources/testng-twoTestCaseSuite/pom.xml
+++ b/surefire-its/src/test/resources/testng-twoTestCaseSuite/pom.xml
@@ -29,8 +29,8 @@
<name>TestNG Suite XML with two test cases</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<profiles>
diff --git a/surefire-its/src/test/resources/timeout-forked/pom.xml b/surefire-its/src/test/resources/timeout-forked/pom.xml
index a36f8f4..fc95eb3 100644
--- a/surefire-its/src/test/resources/timeout-forked/pom.xml
+++ b/surefire-its/src/test/resources/timeout-forked/pom.xml
@@ -29,8 +29,8 @@
<name>Timeout forked process</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
diff --git a/surefire-its/src/test/resources/unicode-testnames/pom.xml b/surefire-its/src/test/resources/unicode-testnames/pom.xml
index cd0a7b8..c186f83 100644
--- a/surefire-its/src/test/resources/unicode-testnames/pom.xml
+++ b/surefire-its/src/test/resources/unicode-testnames/pom.xml
@@ -31,8 +31,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/working-directory-is-invalid-property/pom.xml b/surefire-its/src/test/resources/working-directory-is-invalid-property/pom.xml
index 53d42fb..fa19695 100644
--- a/surefire-its/src/test/resources/working-directory-is-invalid-property/pom.xml
+++ b/surefire-its/src/test/resources/working-directory-is-invalid-property/pom.xml
@@ -28,8 +28,8 @@
<name>Don't run tests if working directory is invalid property.</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
diff --git a/surefire-its/src/test/resources/working-directory-missing/pom.xml b/surefire-its/src/test/resources/working-directory-missing/pom.xml
index de466d9..515a414 100644
--- a/surefire-its/src/test/resources/working-directory-missing/pom.xml
+++ b/surefire-its/src/test/resources/working-directory-missing/pom.xml
@@ -26,8 +26,8 @@
<version>1.0</version>
<name>Run tests in a nonexistent working directory</name>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java b/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
index e6621fb..6c70350 100644
--- a/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
+++ b/surefire-its/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java
@@ -34,13 +34,12 @@ public class BasicTest
File target = new File( System.getProperty( "user.dir" ), "target" ).getAbsoluteFile();
File outFile = new File( target, "out.txt" );
assertTrue( outFile.createNewFile() );
- FileOutputStream os = new FileOutputStream( outFile );
- String userDir = System.getProperty( "user.dir" );
- Properties p = new Properties();
- p.setProperty( "user.dir", userDir );
- p.store( os, "" );
- os.flush();
- os.close();
+ try ( FileOutputStream os = new FileOutputStream( outFile ) )
+ {
+ String userDir = System.getProperty( "user.dir" );
+ Properties p = new Properties();
+ p.setProperty( "user.dir", userDir );
+ p.store( os, "" );
+ }
}
-
}
diff --git a/surefire-its/src/test/resources/working-directory/pom.xml b/surefire-its/src/test/resources/working-directory/pom.xml
index 9880d63..1a7b7d7 100644
--- a/surefire-its/src/test/resources/working-directory/pom.xml
+++ b/surefire-its/src/test/resources/working-directory/pom.xml
@@ -30,8 +30,8 @@
<packaging>pom</packaging>
<properties>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <maven.compiler.source>1.7</maven.compiler.source>
+ <maven.compiler.target>1.7</maven.compiler.target>
</properties>
<modules>
diff --git a/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtils.java b/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtils.java
index 7eca90b..976a48c 100644
--- a/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtils.java
+++ b/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLoggerUtils.java
@@ -36,20 +36,14 @@ public final class ConsoleLoggerUtils
public static String toString( String message, Throwable t )
{
StringWriter result = new StringWriter( 512 );
- PrintWriter writer = new PrintWriter( result );
- try
+ try ( PrintWriter writer = new PrintWriter( result ) )
{
if ( message != null )
{
writer.println( message );
}
t.printStackTrace( writer );
- writer.flush();
return result.toString();
}
- finally
- {
- writer.close();
- }
}
}
diff --git a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java
index 99aca60..626392b 100644
--- a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java
+++ b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java
@@ -52,15 +52,9 @@ public class PojoStackTraceWriter
if ( t != null )
{
StringWriter w = new StringWriter();
- PrintWriter stackTrace = new PrintWriter( w );
- try
+ try ( PrintWriter stackTrace = new PrintWriter( w ) )
{
t.printStackTrace( stackTrace );
- stackTrace.flush();
- }
- finally
- {
- stackTrace.close();
}
StringBuffer builder = w.getBuffer();
if ( isMultiLineExceptionMessage( t ) )
diff --git a/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java b/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java
index 7c4a9cb..85768d9 100644
--- a/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java
+++ b/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3Reflector.java
@@ -45,6 +45,10 @@ public final class JUnit3Reflector
private static final String TEST_SUITE = "junit.framework.TestSuite";
+ private static final Class[] EMPTY_CLASS_ARRAY = { };
+
+ private static final Object[] EMPTY_OBJECT_ARRAY = { };
+
private final Class[] interfacesImplementedByDynamicProxy;
private final Class<?> testResultClass;
@@ -53,10 +57,6 @@ public final class JUnit3Reflector
private final Method testInterfaceRunMethod;
- private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
-
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
private final Class<?> testInterface;
private final Class<?> testCase;
@@ -76,12 +76,12 @@ public final class JUnit3Reflector
// The interface implemented by the dynamic proxy (TestListener), happens to be
// the same as the param types of TestResult.addTestListener
- Class[] addListenerParamTypes = interfacesImplementedByDynamicProxy;
if ( isJUnit3Available() )
{
testsSuiteConstructor = ReflectionUtils.getConstructor( testSuite, constructorParamTypes );
- addListenerMethod = tryGetMethod( testResultClass, ADD_LISTENER_METHOD, addListenerParamTypes );
+ addListenerMethod =
+ tryGetMethod( testResultClass, ADD_LISTENER_METHOD, interfacesImplementedByDynamicProxy );
testInterfaceRunMethod = getMethod( testInterface, RUN_METHOD, testResultClass );
}
else
@@ -154,7 +154,7 @@ public final class JUnit3Reflector
if ( Modifier.isPublic( suiteMethod.getModifiers() ) && Modifier.isStatic( suiteMethod.getModifiers() ) )
{
- testObject = suiteMethod.invoke( null, EMPTY_CLASS_ARRAY );
+ testObject = suiteMethod.invoke( null, EMPTY_OBJECT_ARRAY );
}
}
catch ( NoSuchMethodException e )
diff --git a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4Reflector.java b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4Reflector.java
index 33596f7..bbdeabb 100644
--- a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4Reflector.java
+++ b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4Reflector.java
@@ -19,16 +19,14 @@ package org.apache.maven.surefire.common.junit4;
* under the License.
*/
-import org.apache.maven.surefire.util.SurefireReflectionException;
import org.junit.Ignore;
import org.junit.runner.Description;
-import org.junit.runner.Request;
import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import static org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray;
+import static org.apache.maven.surefire.util.ReflectionUtils.getMethod;
import static org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod;
/**
@@ -39,7 +37,7 @@ public final class JUnit4Reflector
{
private static final Class[] PARAMS = { Class.class };
- private static final Class[] IGNORE_PARAMS = { Ignore.class };
+ private static final Object[] IGNORE_PARAMS = { Ignore.class };
private static final Class[] PARAMS_WITH_ANNOTATIONS = { String.class, Annotation[].class };
@@ -54,34 +52,12 @@ public final class JUnit4Reflector
return getAnnotation == null ? null : (Ignore) invokeMethodWithArray( d, getAnnotation, IGNORE_PARAMS );
}
- public static String getAnnotatedIgnoreValue( Description description )
+ static String getAnnotatedIgnoreValue( Description description )
{
final Ignore ignore = getAnnotatedIgnore( description );
return ignore != null ? ignore.value() : null;
}
- public static Request createRequest( Class<?>... classes )
- {
- try
- {
- return (Request) Request.class.getDeclaredMethod( "classes", Class[].class )// Since of JUnit 4.5
- .invoke( null, new Object[]{ classes } );
- }
- catch ( NoSuchMethodException e )
- {
- return Request.classes( null, classes ); // Since of JUnit 4.0
- }
- catch ( InvocationTargetException e )
- {
- throw new SurefireReflectionException( e.getCause() );
- }
- catch ( IllegalAccessException e )
- {
- // probably JUnit 5.x
- throw new SurefireReflectionException( e );
- }
- }
-
public static Description createDescription( String description )
{
try
@@ -90,8 +66,8 @@ public final class JUnit4Reflector
}
catch ( NoSuchMethodError e )
{
- Method method = tryGetMethod( Description.class, "createSuiteDescription", PARAMS_WITH_ANNOTATIONS );
- // may throw exception probably with JUnit 5.x
+ Method method = getMethod( Description.class, "createSuiteDescription", PARAMS_WITH_ANNOTATIONS );
+ // may throw exception probably with broken JUnit 4.x
return (Description) invokeMethodWithArray( null, method, description, new Annotation[0] );
}
}
@@ -109,6 +85,7 @@ public final class JUnit4Reflector
return new IgnoredWithUserError( value );
}
+ @SuppressWarnings( "ClassExplicitlyAnnotation" )
private static class IgnoredWithUserError
implements Annotation, Ignore
{
@@ -119,11 +96,6 @@ public final class JUnit4Reflector
this.value = value;
}
- IgnoredWithUserError()
- {
- this( "" );
- }
-
@Override
public String value()
{
@@ -156,15 +128,7 @@ public final class JUnit4Reflector
private boolean equalValue( Ignore ignore )
{
- if ( ignore == null )
- {
- return false;
- }
- else
- {
- String val = ignore.value();
- return val == null ? value == null : val.equals( value );
- }
+ return ignore != null && ignore.value().equals( value );
}
}
}
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
index 4dd1bbc..df08602 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java
@@ -38,7 +38,6 @@ public final class JUnitTestSet
private final JUnit3Reflector reflector;
public JUnitTestSet( Class testClass, JUnit3Reflector reflector )
- throws TestSetFailedException
{
if ( testClass == null )
{
@@ -99,18 +98,6 @@ public final class JUnitTestSet
runMethod.invoke( testObject, runParams );
}
- catch ( IllegalArgumentException e )
- {
- throw new TestSetFailedException( testClass.getName(), e );
- }
- catch ( InstantiationException e )
- {
- throw new TestSetFailedException( testClass.getName(), e );
- }
- catch ( IllegalAccessException e )
- {
- throw new TestSetFailedException( testClass.getName(), e );
- }
catch ( InvocationTargetException e )
{
throw new TestSetFailedException( testClass.getName(), e.getTargetException() );
@@ -119,6 +106,10 @@ public final class JUnitTestSet
{
throw new TestSetFailedException( "Class is not a JUnit TestCase", e );
}
+ catch ( ReflectiveOperationException e )
+ {
+ throw new TestSetFailedException( testClass.getName(), e );
+ }
}
@Override
@@ -127,7 +118,7 @@ public final class JUnitTestSet
return testClass.getName();
}
- Class getTestClass()
+ private Class getTestClass()
{
return testClass;
}
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
index 3d28022..1b23322 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
@@ -67,11 +67,7 @@ public class PojoTestSet
{
testObject = testClass.newInstance();
}
- catch ( InstantiationException e )
- {
- throw new TestSetFailedException( "Unable to instantiate POJO '" + testClass + "'", e );
- }
- catch ( IllegalAccessException e )
+ catch ( ReflectiveOperationException e )
{
throw new TestSetFailedException( "Unable to instantiate POJO '" + testClass + "'", e );
}
@@ -79,7 +75,6 @@ public class PojoTestSet
@Override
public void execute( RunListener reportManager, ClassLoader loader )
- throws TestSetFailedException
{
if ( reportManager == null )
{
@@ -220,7 +215,7 @@ public class PojoTestSet
{
if ( testMethods == null )
{
- testMethods = new ArrayList<Method>();
+ testMethods = new ArrayList<>();
Method[] methods = getTestClass().getMethods();
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
index c96b96d..78e78ad 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/TestListenerInvocationHandler.java
@@ -45,13 +45,13 @@ public class TestListenerInvocationHandler
private static final String END_TEST = "endTest";
- private final Set<FailedTest> failedTestsSet = new HashSet<FailedTest>();
+ private final Set<FailedTest> failedTestsSet = new HashSet<>();
private RunListener reporter;
- private static final Class[] EMPTY_CLASS_ARRAY = new Class[]{ };
+ private static final Class[] EMPTY_CLASS_ARRAY = { };
- private static final String[] EMPTY_STRING_ARRAY = new String[]{ };
+ private static final Object[] EMPTY_STRING_ARRAY = { };
private static class FailedTest
{
@@ -125,28 +125,29 @@ public class TestListenerInvocationHandler
{
String methodName = method.getName();
- if ( methodName.equals( START_TEST ) )
+ switch ( methodName )
{
- handleStartTest( args );
- }
- else if ( methodName.equals( ADD_ERROR ) )
- {
- handleAddError( args );
- }
- else if ( methodName.equals( ADD_FAILURE ) )
- {
- handleAddFailure( args );
- }
- else if ( methodName.equals( END_TEST ) )
- {
- handleEndTest( args );
+ case START_TEST:
+ handleStartTest( args );
+ break;
+ case ADD_ERROR:
+ handleAddError( args );
+ break;
+ case ADD_FAILURE:
+ handleAddFailure( args );
+ break;
+ case END_TEST:
+ handleEndTest( args );
+ break;
+ default:
+ break;
}
return null;
}
// Handler for TestListener.startTest(Test)
- public void handleStartTest( Object[] args )
+ private void handleStartTest( Object[] args )
{
ReportEntry report = new SimpleReportEntry( args[0].getClass().getName(), args[0].toString() );
diff --git a/surefire-providers/surefire-junit3/src/test/java/org/apache/maven/surefire/junit/JUnitTestSetTest.java b/surefire-providers/surefire-junit3/src/test/java/org/apache/maven/surefire/junit/JUnitTestSetTest.java
index 9c08fd9..977ac9e 100644
--- a/surefire-providers/surefire-junit3/src/test/java/org/apache/maven/surefire/junit/JUnitTestSetTest.java
+++ b/surefire-providers/surefire-junit3/src/test/java/org/apache/maven/surefire/junit/JUnitTestSetTest.java
@@ -26,7 +26,6 @@ import org.apache.maven.surefire.common.junit3.JUnit3Reflector;
import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.RunListener;
import org.apache.maven.surefire.report.TestSetReportEntry;
-import org.apache.maven.surefire.testset.TestSetFailedException;
import java.util.ArrayList;
import java.util.List;
@@ -36,7 +35,7 @@ public class JUnitTestSetTest
{
public void testExecuteSuiteClass()
- throws TestSetFailedException
+ throws Exception
{
ClassLoader testClassLoader = this.getClass().getClassLoader();
JUnit3Reflector reflector = new JUnit3Reflector( testClassLoader );
@@ -62,7 +61,7 @@ public class JUnitTestSetTest
implements RunListener
{
- private List<ReportEntry> succeededTests = new ArrayList<ReportEntry>();
+ private List<ReportEntry> succeededTests = new ArrayList<>();
@Override
public void testSetStarting( TestSetReportEntry report )
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/Scheduler.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/Scheduler.java
index cf2b7ac..8be4309 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/Scheduler.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/Scheduler.java
@@ -52,7 +52,7 @@ public class Scheduler
private final SchedulingStrategy strategy;
- private final Set<Controller> slaves = new CopyOnWriteArraySet<Controller>();
+ private final Set<Controller> slaves = new CopyOnWriteArraySet<>();
private final Description description;
@@ -220,15 +220,10 @@ public class Scheduler
protected void logQuietly( Throwable t )
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
- PrintStream stream = new PrintStream( out );
- try
+ try ( PrintStream stream = new PrintStream( out ) )
{
t.printStackTrace( stream );
}
- finally
- {
- stream.close();
- }
logger.println( out.toString() );
}
@@ -249,8 +244,8 @@ public class Scheduler
*/
protected ShutdownResult describeStopped( boolean stopNow )
{
- Collection<Description> executedTests = new ConcurrentLinkedQueue<Description>();
- Collection<Description> incompleteTests = new ConcurrentLinkedQueue<Description>();
+ Collection<Description> executedTests = new ConcurrentLinkedQueue<>();
+ Collection<Description> incompleteTests = new ConcurrentLinkedQueue<>();
stop( executedTests, incompleteTests, false, stopNow );
return new ShutdownResult( executedTests, incompleteTests );
}
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategy.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategy.java
index d310628..d9cf83a 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategy.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategy.java
@@ -135,15 +135,9 @@ public abstract class SchedulingStrategy
protected void logQuietly( Throwable t )
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
- PrintStream stream = new PrintStream( out );
- try
+ try ( PrintStream stream = new PrintStream( out ) )
{
t.printStackTrace( stream );
- stream.flush();
- }
- finally
- {
- stream.close();
}
logger.println( out.toString() );
}
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
index 0b52c4d..6bc30a3 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
@@ -95,9 +95,9 @@ final class TestNGExecutor
XmlMethodSelector groupMatchingSelector = createGroupMatchingSelector( options );
XmlMethodSelector methodNameFilteringSelector = createMethodNameFilteringSelector( methodFilter );
- Map<String, SuiteAndNamedTests> suitesNames = new HashMap<String, SuiteAndNamedTests>();
+ Map<String, SuiteAndNamedTests> suitesNames = new HashMap<>();
- List<XmlSuite> xmlSuites = new ArrayList<XmlSuite>();
+ List<XmlSuite> xmlSuites = new ArrayList<>();
for ( Class<?> testClass : testClasses )
{
TestMetadata metadata = findTestMetadata( testClass );
@@ -189,7 +189,7 @@ final class TestNGExecutor
{
private XmlSuite xmlSuite = new XmlSuite();
- private Map<String, XmlTest> testNameToTest = new HashMap<String, XmlTest>();
+ private Map<String, XmlTest> testNameToTest = new HashMap<>();
}
private static void addSelector( XmlTest xmlTest, XmlMethodSelector selector )
@@ -289,15 +289,7 @@ final class TestNGExecutor
{
return (Configurator) Class.forName( className ).newInstance();
}
- catch ( InstantiationException e )
- {
- throw new RuntimeException( e );
- }
- catch ( IllegalAccessException e )
- {
- throw new RuntimeException( e );
- }
- catch ( ClassNotFoundException e )
+ catch ( ReflectiveOperationException e )
{
throw new RuntimeException( e );
}
diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
index c51aca6..a837cc3 100755
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNGMapConfigurator.java
@@ -81,59 +81,39 @@ public class TestNGMapConfigurator
{
String key = entry.getKey();
Object val = entry.getValue();
- // todo: use switch-case of jdk7
- if ( "listener".equals( key ) )
- {
- val = convertListeners( entry.getValue() );
- }
- else if ( "objectfactory".equals( key ) )
- {
- val = AbstractDirectConfigurator.loadClass( entry.getValue() );
- }
- else if ( "testrunfactory".equals( key ) )
- {
- val = AbstractDirectConfigurator.loadClass( entry.getValue() );
- }
- else if ( "reporter".equals( key ) )
- {
- // for TestNG 5.6 or higher
- // TODO support multiple reporters?
- val = convertReporterConfig( val );
- key = "reporterslist";
- }
- else if ( "junit".equals( key ) )
- {
- val = convert( val, Boolean.class );
- }
- else if ( "skipfailedinvocationcounts".equals( key ) )
- {
- val = convert( val, Boolean.class );
- }
- else if ( "mixed".equals( key ) )
- {
- val = convert( val, Boolean.class );
- }
- else if ( "configfailurepolicy".equals( key ) )
- {
- val = convert( val, String.class );
- }
- else if ( "group-by-instances".equals( key ) )
- {
- val = convert( val, Boolean.class );
- }
- else if ( THREADCOUNT_PROP.equals( key ) )
- {
- val = convert ( val, String.class );
- }
- else if ( "suitethreadpoolsize".equals( key ) )
+ switch ( key )
{
+ case "listener":
+ val = convertListeners( entry.getValue() );
+ break;
+ case "objectfactory":
+ case "testrunfactory":
+ val = AbstractDirectConfigurator.loadClass( entry.getValue() );
+ break;
+ case "reporter":
+ // for TestNG 5.6 or higher
+ // TODO support multiple reporters?
+ val = convertReporterConfig( val );
+ key = "reporterslist";
+ break;
+ case "junit":
+ case "skipfailedinvocationcounts":
+ case "mixed":
+ case "group-by-instances":
+ val = convert( val, Boolean.class );
+ break;
+ case "configfailurepolicy":
+ case THREADCOUNT_PROP:
+ val = convert( val, String.class );
+ break;
// for TestNG 6.9.7 or higher
- val = convert( val, Integer.class );
- }
- else if ( "dataproviderthreadcount".equals( key ) )
- {
- // for TestNG 5.10 or higher
- val = convert( val, Integer.class );
+ case "suitethreadpoolsize":
+ // for TestNG 5.10 or higher
+ case "dataproviderthreadcount":
+ val = convert( val, Integer.class );
+ break;
+ default:
+ break;
}
if ( key.startsWith( "-" ) )
diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
index 721106e..943bcdd 100644
--- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
+++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
@@ -41,6 +41,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
+import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Locale.ENGLISH;
/**
@@ -75,17 +76,10 @@ public final class TestSuiteXmlParser
public List<ReportTestSuite> parse( String xmlPath )
throws ParserConfigurationException, SAXException, IOException
{
- FileInputStream fileInputStream = new FileInputStream( new File( xmlPath ) );
- InputStreamReader inputStreamReader = new InputStreamReader( fileInputStream, "UTF-8" );
-
- try
- {
- return parse( inputStreamReader );
- }
- finally
+ File f = new File( xmlPath );
+ try ( InputStreamReader stream = new InputStreamReader( new FileInputStream( f ), UTF_8 ) )
{
- inputStreamReader.close();
- fileInputStream.close();
+ return parse( stream );
}
}
@@ -98,8 +92,8 @@ public final class TestSuiteXmlParser
valid = true;
- classesToSuitesIndex = new HashMap<String, Integer>();
- suites = new ArrayList<ReportTestSuite>();
+ classesToSuitesIndex = new HashMap<>();
+ suites = new ArrayList<>();
saxParser.parse( new InputSource( stream ), this );
@@ -125,94 +119,92 @@ public final class TestSuiteXmlParser
{
try
{
- // todo: use jdk7 switch-case
- if ( "testsuite".equals( qName ) )
+ switch ( qName )
{
- defaultSuite = new ReportTestSuite();
- currentSuite = defaultSuite;
-
- try
- {
- Number time = numberFormat.parse( attributes.getValue( "time" ) );
-
- defaultSuite.setTimeElapsed( time.floatValue() );
- }
- catch ( NullPointerException e )
- {
- consoleLogger.error( "WARNING: no time attribute found on testsuite element" );
- }
-
- final String name = attributes.getValue( "name" );
- final String group = attributes.getValue( "group" );
- defaultSuite.setFullClassName( StringUtils.isBlank( group )
- ? /*name is full class name*/ name
- : /*group is package name*/ group + "." + name );
-
- suites.add( defaultSuite );
- classesToSuitesIndex.put( defaultSuite.getFullClassName(), suites.size() - 1 );
- }
- else if ( "testcase".equals( qName ) )
- {
- currentElement = new StringBuilder();
-
- testCase = new ReportTestCase()
- .setName( attributes.getValue( "name" ) );
+ case "testsuite":
+ defaultSuite = new ReportTestSuite();
+ currentSuite = defaultSuite;
- String fullClassName = attributes.getValue( "classname" );
+ try
+ {
+ Number time = numberFormat.parse( attributes.getValue( "time" ) );
- // if the testcase declares its own classname, it may need to belong to its own suite
- if ( fullClassName != null )
- {
- Integer currentSuiteIndex = classesToSuitesIndex.get( fullClassName );
- if ( currentSuiteIndex == null )
+ defaultSuite.setTimeElapsed( time.floatValue() );
+ }
+ catch ( NullPointerException e )
{
- currentSuite = new ReportTestSuite()
- .setFullClassName( fullClassName );
- suites.add( currentSuite );
- classesToSuitesIndex.put( fullClassName, suites.size() - 1 );
+ consoleLogger.error( "WARNING: no time attribute found on testsuite element" );
}
- else
+
+ final String name = attributes.getValue( "name" );
+ final String group = attributes.getValue( "group" );
+ defaultSuite.setFullClassName( StringUtils.isBlank( group )
+ ? /*name is full class name*/ name
+ : /*group is package name*/ group + "." + name );
+
+ suites.add( defaultSuite );
+ classesToSuitesIndex.put( defaultSuite.getFullClassName(), suites.size() - 1 );
+ break;
+ case "testcase":
+ currentElement = new StringBuilder();
+
+ testCase = new ReportTestCase()
+ .setName( attributes.getValue( "name" ) );
+
+ String fullClassName = attributes.getValue( "classname" );
+
+ // if the testcase declares its own classname, it may need to belong to its own suite
+ if ( fullClassName != null )
{
- currentSuite = suites.get( currentSuiteIndex );
+ Integer currentSuiteIndex = classesToSuitesIndex.get( fullClassName );
+ if ( currentSuiteIndex == null )
+ {
+ currentSuite = new ReportTestSuite()
+ .setFullClassName( fullClassName );
+ suites.add( currentSuite );
+ classesToSuitesIndex.put( fullClassName, suites.size() - 1 );
+ }
+ else
+ {
+ currentSuite = suites.get( currentSuiteIndex );
+ }
}
- }
- final String timeAsString = attributes.getValue( "time" );
- final Number time = StringUtils.isBlank( timeAsString ) ? 0 : numberFormat.parse( timeAsString );
+ String timeAsString = attributes.getValue( "time" );
+ Number time = StringUtils.isBlank( timeAsString ) ? 0 : numberFormat.parse( timeAsString );
- testCase.setFullClassName( currentSuite.getFullClassName() )
- .setClassName( currentSuite.getName() )
- .setFullName( currentSuite.getFullClassName() + "." + testCase.getName() )
- .setTime( time.floatValue() );
+ testCase.setFullClassName( currentSuite.getFullClassName() )
+ .setClassName( currentSuite.getName() )
+ .setFullName( currentSuite.getFullClassName() + "." + testCase.getName() )
+ .setTime( time.floatValue() );
- if ( currentSuite != defaultSuite )
- {
- currentSuite.setTimeElapsed( testCase.getTime() + currentSuite.getTimeElapsed() );
- }
- }
- else if ( "failure".equals( qName ) )
- {
- testCase.setFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) );
- currentSuite.incrementNumberOfFailures();
- }
- else if ( "error".equals( qName ) )
- {
- testCase.setError( attributes.getValue( "message" ), attributes.getValue( "type" ) );
- currentSuite.incrementNumberOfErrors();
- }
- else if ( "skipped".equals( qName ) )
- {
- String message = attributes.getValue( "message" );
- testCase.setSkipped( message != null ? message : "skipped" );
- currentSuite.incrementNumberOfSkipped();
- }
- else if ( "flakyFailure".equals( qName ) || "flakyError".equals( qName ) )
- {
- currentSuite.incrementNumberOfFlakes();
- }
- else if ( "failsafe-summary".equals( qName ) )
- {
- valid = false;
+ if ( currentSuite != defaultSuite )
+ {
+ currentSuite.setTimeElapsed( testCase.getTime() + currentSuite.getTimeElapsed() );
+ }
+ break;
+ case "failure":
+ testCase.setFailure( attributes.getValue( "message" ), attributes.getValue( "type" ) );
+ currentSuite.incrementNumberOfFailures();
+ break;
+ case "error":
+ testCase.setError( attributes.getValue( "message" ), attributes.getValue( "type" ) );
+ currentSuite.incrementNumberOfErrors();
+ break;
+ case "skipped":
+ String message = attributes.getValue( "message" );
+ testCase.setSkipped( message != null ? message : "skipped" );
+ currentSuite.incrementNumberOfSkipped();
+ break;
+ case "flakyFailure":
+ case "flakyError":
+ currentSuite.incrementNumberOfFlakes();
+ break;
+ case "failsafe-summary":
+ valid = false;
+ break;
+ default:
+ break;
}
}
catch ( ParseException e )
@@ -229,26 +221,28 @@ public final class TestSuiteXmlParser
public void endElement( String uri, String localName, String qName )
throws SAXException
{
- // todo: use jdk7 switch-case
- if ( "testcase".equals( qName ) )
- {
- currentSuite.getTestCases().add( testCase );
- }
- else if ( "failure".equals( qName ) || "error".equals( qName ) )
- {
- testCase.setFailureDetail( currentElement.toString() )
- .setFailureErrorLine( parseErrorLine( currentElement, testCase.getFullClassName() ) );
- }
- else if ( "time".equals( qName ) )
+ switch ( qName )
{
- try
- {
- defaultSuite.setTimeElapsed( numberFormat.parse( currentElement.toString() ).floatValue() );
- }
- catch ( ParseException e )
- {
- throw new SAXException( e.getMessage(), e );
- }
+ case "testcase":
+ currentSuite.getTestCases().add( testCase );
+ break;
+ case "failure":
+ case "error":
+ testCase.setFailureDetail( currentElement.toString() )
+ .setFailureErrorLine( parseErrorLine( currentElement, testCase.getFullClassName() ) );
+ break;
+ case "time":
+ try
+ {
+ defaultSuite.setTimeElapsed( numberFormat.parse( currentElement.toString() ).floatValue() );
+ }
+ catch ( ParseException e )
+ {
+ throw new SAXException( e.getMessage(), e );
+ }
+ break;
+ default:
+ break;
}
// TODO extract real skipped reasons
}
@@ -258,7 +252,6 @@ public final class TestSuiteXmlParser
*/
@Override
public void characters( char[] ch, int start, int length )
- throws SAXException
{
assert start >= 0;
assert length >= 0;