| @@ -127,7 +127,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||||
| * enumeration; <code>false</code> otherwise. | * enumeration; <code>false</code> otherwise. | ||||
| */ | */ | ||||
| public boolean hasMoreElements() { | public boolean hasMoreElements() { | ||||
| return (this.nextResource != null); | |||||
| return this.nextResource != null; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -369,8 +369,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo | |||||
| } catch (final BuildException e) { | } catch (final BuildException e) { | ||||
| // ignore path elements which are invalid | // ignore path elements which are invalid | ||||
| // relative to the project | // relative to the project | ||||
| log("Ignoring path element " + pathElement + " from " + | |||||
| "classpath due to exception " + e, Project.MSG_DEBUG); | |||||
| log("Ignoring path element " + pathElement + " from " | |||||
| + "classpath due to exception " + e, Project.MSG_DEBUG); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1245,8 +1245,8 @@ public class DirectoryScanner | |||||
| continue; | continue; | ||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| System.err.println("Failed to determine if " + file + " causes a " + | |||||
| "filesystem loop due to symbolic link; continuing"); | |||||
| System.err.println("Failed to determine if " + file + " causes a " | |||||
| + "filesystem loop due to symbolic link; continuing"); | |||||
| } | } | ||||
| final String[] children = file.list(); | final String[] children = file.list(); | ||||
| @@ -1066,10 +1066,8 @@ public class Main implements AntMain { | |||||
| props.load(in); | props.load(in); | ||||
| in.close(); | in.close(); | ||||
| shortAntVersion = props.getProperty("VERSION"); | shortAntVersion = props.getProperty("VERSION"); | ||||
| antVersion = "Apache Ant(TM) version " + | |||||
| shortAntVersion + | |||||
| " compiled on " + | |||||
| props.getProperty("DATE"); | |||||
| antVersion = "Apache Ant(TM) version " + shortAntVersion | |||||
| + " compiled on " + props.getProperty("DATE"); | |||||
| } catch (final IOException ioe) { | } catch (final IOException ioe) { | ||||
| throw new BuildException("Could not load the version information:" | throw new BuildException("Could not load the version information:" | ||||
| + ioe.getMessage()); | + ioe.getMessage()); | ||||
| @@ -1019,10 +1019,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
| project.addOrReplaceTarget(newName, newTarget); | project.addOrReplaceTarget(newName, newTarget); | ||||
| } | } | ||||
| if (extensionPointMissing != null && extensionPoint == null) { | if (extensionPointMissing != null && extensionPoint == null) { | ||||
| throw new BuildException("onMissingExtensionPoint attribute cannot " + | |||||
| "be specified unless extensionOf is specified", | |||||
| target.getLocation()); | |||||
| throw new BuildException("onMissingExtensionPoint attribute cannot " | |||||
| + "be specified unless extensionOf is specified", target.getLocation()); | |||||
| } | } | ||||
| if (extensionPoint != null) { | if (extensionPoint != null) { | ||||
| ProjectHelper helper = | ProjectHelper helper = | ||||
| @@ -819,12 +819,12 @@ public class Delete extends MatchingTask { | |||||
| boolean isFsLoop = false; | boolean isFsLoop = false; | ||||
| try { | try { | ||||
| isFsLoop = Files.isSymbolicLink(f.toPath()) && | |||||
| FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(), | |||||
| isFsLoop = Files.isSymbolicLink(f.toPath()) | |||||
| && FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(), | |||||
| d.getAbsoluteFile(), true); | d.getAbsoluteFile(), true); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| log("Failed to check if " + f + " causes a filesystem loop due to " + | |||||
| "symbolic link; continuing"); | |||||
| log("Failed to check if " + f + " causes a filesystem loop due to " | |||||
| + "symbolic link; continuing"); | |||||
| } | } | ||||
| if (f.isDirectory() && !isFsLoop) { | if (f.isDirectory() && !isFsLoop) { | ||||
| @@ -53,6 +53,12 @@ public class Java extends Task { | |||||
| private static final String TIMEOUT_MESSAGE = | private static final String TIMEOUT_MESSAGE = | ||||
| "Timeout: killed the sub-process"; | "Timeout: killed the sub-process"; | ||||
| private static final String WRONG_ATTRIBUTES_MESSAGE = | |||||
| "Cannot use combination of 'classname', 'jar', 'module', 'sourcefile' attributes in same command"; | |||||
| private static final String WRONG_CLASSNAME_ATTRIBUTES_MESSAGE = | |||||
| "Cannot use combination of 'classname', 'jar', 'sourcefile' attributes in same command"; | |||||
| private CommandlineJava cmdl = new CommandlineJava(); | private CommandlineJava cmdl = new CommandlineJava(); | ||||
| private Environment env = new Environment(); | private Environment env = new Environment(); | ||||
| private boolean fork = false; | private boolean fork = false; | ||||
| @@ -365,8 +371,7 @@ public class Java extends Task { | |||||
| public void setJar(File jarfile) throws BuildException { | public void setJar(File jarfile) throws BuildException { | ||||
| if (getCommandLine().getClassname() != null || getCommandLine().getModule() != null | if (getCommandLine().getClassname() != null || getCommandLine().getModule() != null | ||||
| || getCommandLine().getSourceFile() != null) { | || getCommandLine().getSourceFile() != null) { | ||||
| throw new BuildException( | |||||
| "Cannot use combination of 'jar', 'sourcefile', 'classname', 'module' attributes in same command"); | |||||
| throw new BuildException(WRONG_ATTRIBUTES_MESSAGE); | |||||
| } | } | ||||
| getCommandLine().setJar(jarfile.getAbsolutePath()); | getCommandLine().setJar(jarfile.getAbsolutePath()); | ||||
| } | } | ||||
| @@ -380,8 +385,7 @@ public class Java extends Task { | |||||
| */ | */ | ||||
| public void setClassname(String s) throws BuildException { | public void setClassname(String s) throws BuildException { | ||||
| if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { | if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { | ||||
| throw new BuildException( | |||||
| "Cannot use combination of 'jar', 'classname', sourcefile attributes in same command"); | |||||
| throw new BuildException(WRONG_CLASSNAME_ATTRIBUTES_MESSAGE); | |||||
| } | } | ||||
| getCommandLine().setClassname(s); | getCommandLine().setClassname(s); | ||||
| } | } | ||||
| @@ -396,8 +400,7 @@ public class Java extends Task { | |||||
| */ | */ | ||||
| public void setModule(String module) throws BuildException { | public void setModule(String module) throws BuildException { | ||||
| if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { | if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { | ||||
| throw new BuildException( | |||||
| "Cannot use combination of 'jar', 'module', sourcefile attributes in same command"); | |||||
| throw new BuildException(WRONG_CLASSNAME_ATTRIBUTES_MESSAGE); | |||||
| } | } | ||||
| getCommandLine().setModule(module); | getCommandLine().setModule(module); | ||||
| } | } | ||||
| @@ -412,12 +415,9 @@ public class Java extends Task { | |||||
| * @since Ant 1.10.5 | * @since Ant 1.10.5 | ||||
| */ | */ | ||||
| public void setSourceFile(final String sourceFile) throws BuildException { | public void setSourceFile(final String sourceFile) throws BuildException { | ||||
| final String jar = getCommandLine().getJar(); | |||||
| final String className = getCommandLine().getClassname(); | |||||
| final String module = getCommandLine().getModule(); | |||||
| if (jar != null || className != null || module != null) { | |||||
| throw new BuildException("Cannot use 'sourcefile' in combination with 'jar' or " + | |||||
| "'module' or 'classname'"); | |||||
| if (getCommandLine().getClassname() != null || getCommandLine().getJar() != null | |||||
| || getCommandLine().getModule() != null) { | |||||
| throw new BuildException(WRONG_ATTRIBUTES_MESSAGE); | |||||
| } | } | ||||
| getCommandLine().setSourceFile(sourceFile); | getCommandLine().setSourceFile(sourceFile); | ||||
| } | } | ||||
| @@ -111,8 +111,7 @@ public class MimeMailer extends Mailer { | |||||
| return type; | return type; | ||||
| } | } | ||||
| // Must be like "text/plain; charset=windows-1251" | // Must be like "text/plain; charset=windows-1251" | ||||
| return (type != null ? type : "text/plain") + | |||||
| "; charset=" + charset; | |||||
| return (type != null ? type : "text/plain") + "; charset=" + charset; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -83,15 +83,15 @@ public class JavahAdapterFactory { | |||||
| Path classpath) | Path classpath) | ||||
| throws BuildException { | throws BuildException { | ||||
| if ((JavaEnvUtils.isKaffe() && choice == null) | if ((JavaEnvUtils.isKaffe() && choice == null) | ||||
| || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) { | |||||
| || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) { | |||||
| return new Kaffeh(); | return new Kaffeh(); | ||||
| } | } | ||||
| if ((JavaEnvUtils.isGij() && choice == null) | if ((JavaEnvUtils.isGij() && choice == null) | ||||
| || Gcjh.IMPLEMENTATION_NAME.equals(choice)) { | |||||
| || Gcjh.IMPLEMENTATION_NAME.equals(choice)) { | |||||
| return new Gcjh(); | return new Gcjh(); | ||||
| } | } | ||||
| if (JavaEnvUtils.isAtLeastJavaVersion("10") && | |||||
| (choice == null || ForkingJavah.IMPLEMENTATION_NAME.equals(choice))) { | |||||
| if (JavaEnvUtils.isAtLeastJavaVersion("10") | |||||
| && (choice == null || ForkingJavah.IMPLEMENTATION_NAME.equals(choice))) { | |||||
| throw new BuildException("javah does not exist under Java 10 and higher," | throw new BuildException("javah does not exist under Java 10 and higher," | ||||
| + " use the javac task with nativeHeaderDir instead"); | + " use the javac task with nativeHeaderDir instead"); | ||||
| } | } | ||||
| @@ -2067,8 +2067,7 @@ public class JUnitTask extends Task { | |||||
| */ | */ | ||||
| @Override | @Override | ||||
| public boolean equals(final Object other) { | public boolean equals(final Object other) { | ||||
| if (other == null | |||||
| || other.getClass() != ForkedTestConfiguration.class) { | |||||
| if (other == null || other.getClass() != ForkedTestConfiguration.class) { | |||||
| return false; | return false; | ||||
| } | } | ||||
| final ForkedTestConfiguration o = (ForkedTestConfiguration) other; | final ForkedTestConfiguration o = (ForkedTestConfiguration) other; | ||||
| @@ -2076,13 +2075,9 @@ public class JUnitTask extends Task { | |||||
| && haltOnError == o.haltOnError | && haltOnError == o.haltOnError | ||||
| && haltOnFailure == o.haltOnFailure | && haltOnFailure == o.haltOnFailure | ||||
| && ((errorProperty == null && o.errorProperty == null) | && ((errorProperty == null && o.errorProperty == null) | ||||
| || | |||||
| (errorProperty != null | |||||
| && errorProperty.equals(o.errorProperty))) | |||||
| || (errorProperty != null && errorProperty.equals(o.errorProperty))) | |||||
| && ((failureProperty == null && o.failureProperty == null) | && ((failureProperty == null && o.failureProperty == null) | ||||
| || | |||||
| (failureProperty != null | |||||
| && failureProperty.equals(o.failureProperty))); | |||||
| || (failureProperty != null && failureProperty.equals(o.failureProperty))); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -206,8 +206,8 @@ public class LauncherSupport { | |||||
| final Optional<Project> project = this.testExecutionContext.getProject(); | final Optional<Project> project = this.testExecutionContext.getProject(); | ||||
| for (final ListenerDefinition applicableListener : applicableListenerElements) { | for (final ListenerDefinition applicableListener : applicableListenerElements) { | ||||
| if (project.isPresent() && !applicableListener.shouldUse(project.get())) { | if (project.isPresent() && !applicableListener.shouldUse(project.get())) { | ||||
| log("Excluding listener " + applicableListener.getClassName() + " since it's not applicable" + | |||||
| " in the context of project", null, Project.MSG_DEBUG); | |||||
| log("Excluding listener " + applicableListener.getClassName() + " since it's not applicable" | |||||
| + " in the context of project", null, Project.MSG_DEBUG); | |||||
| continue; | continue; | ||||
| } | } | ||||
| final TestExecutionListener listener = requireTestExecutionListener(applicableListener, classLoader); | final TestExecutionListener listener = requireTestExecutionListener(applicableListener, classLoader); | ||||
| @@ -274,7 +274,8 @@ public class LauncherSupport { | |||||
| throw new BuildException("Failed to load listener class " + className, e); | throw new BuildException("Failed to load listener class " + className, e); | ||||
| } | } | ||||
| if (!TestExecutionListener.class.isAssignableFrom(klass)) { | if (!TestExecutionListener.class.isAssignableFrom(klass)) { | ||||
| throw new BuildException("Listener class " + className + " is not of type " + TestExecutionListener.class.getName()); | |||||
| throw new BuildException("Listener class " + className + " is not of type " | |||||
| + TestExecutionListener.class.getName()); | |||||
| } | } | ||||
| try { | try { | ||||
| return (TestExecutionListener) klass.newInstance(); | return (TestExecutionListener) klass.newInstance(); | ||||
| @@ -308,7 +309,8 @@ public class LauncherSupport { | |||||
| // if the test is configured to halt on test failures, throw a build error | // if the test is configured to halt on test failures, throw a build error | ||||
| final String errorMessage; | final String errorMessage; | ||||
| if (test instanceof NamedTest) { | if (test instanceof NamedTest) { | ||||
| errorMessage = "Test " + ((NamedTest) test).getName() + " has " + summary.getTestsFailedCount() + " failure(s)"; | |||||
| errorMessage = "Test " + ((NamedTest) test).getName() + " has " | |||||
| + summary.getTestsFailedCount() + " failure(s)"; | |||||
| } else { | } else { | ||||
| errorMessage = "Some test(s) have failure(s)"; | errorMessage = "Some test(s) have failure(s)"; | ||||
| } | } | ||||
| @@ -366,7 +368,8 @@ public class LauncherSupport { | |||||
| final Thread sysErrStreamer = new Thread(streamer); | final Thread sysErrStreamer = new Thread(streamer); | ||||
| sysErrStreamer.setDaemon(true); | sysErrStreamer.setDaemon(true); | ||||
| sysErrStreamer.setName("junitlauncher-syserr-stream-reader"); | sysErrStreamer.setName("junitlauncher-syserr-stream-reader"); | ||||
| sysErrStreamer.setUncaughtExceptionHandler((t, e) -> this.log("Failed in syserr streaming", e, Project.MSG_INFO)); | |||||
| sysErrStreamer.setUncaughtExceptionHandler((t, e) -> this.log("Failed in syserr streaming", | |||||
| e, Project.MSG_INFO)); | |||||
| sysErrStreamer.start(); | sysErrStreamer.start(); | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -87,8 +87,8 @@ public class JUnitLauncherTask extends Task { | |||||
| final Project project = getProject(); | final Project project = getProject(); | ||||
| for (final TestDefinition test : this.tests) { | for (final TestDefinition test : this.tests) { | ||||
| if (!test.shouldRun(project)) { | if (!test.shouldRun(project)) { | ||||
| log("Excluding test " + test + " since it's considered not to run " + | |||||
| "in context of project " + project, Project.MSG_DEBUG); | |||||
| log("Excluding test " + test + " since it's considered not to run " | |||||
| + "in context of project " + project, Project.MSG_DEBUG); | |||||
| continue; | continue; | ||||
| } | } | ||||
| if (test.getForkDefinition() != null) { | if (test.getForkDefinition() != null) { | ||||
| @@ -214,8 +214,8 @@ public class JUnitLauncherTask extends Task { | |||||
| try { | try { | ||||
| projectPropsPath = dumpProjectProperties(); | projectPropsPath = dumpProjectProperties(); | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| throw new BuildException("Could not create the necessary properties file while forking a process" + | |||||
| " for a test", e); | |||||
| throw new BuildException("Could not create the necessary properties file while forking" | |||||
| + " a process for a test", e); | |||||
| } | } | ||||
| // --properties <path-to-properties-file> | // --properties <path-to-properties-file> | ||||
| commandlineJava.createArgument().setValue(Constants.ARG_PROPERTIES); | commandlineJava.createArgument().setValue(Constants.ARG_PROPERTIES); | ||||
| @@ -72,8 +72,8 @@ class FTPConfigurator { | |||||
| if (!serverLanguageCodeConfig.isEmpty() | if (!serverLanguageCodeConfig.isEmpty() | ||||
| && !FTPClientConfig.getSupportedLanguageCodes() | && !FTPClientConfig.getSupportedLanguageCodes() | ||||
| .contains(serverLanguageCodeConfig)) { | .contains(serverLanguageCodeConfig)) { | ||||
| throw new BuildException("unsupported language code" + | |||||
| serverLanguageCodeConfig); | |||||
| throw new BuildException("unsupported language code" | |||||
| + serverLanguageCodeConfig); | |||||
| } | } | ||||
| config.setServerLanguageCode(serverLanguageCodeConfig); | config.setServerLanguageCode(serverLanguageCodeConfig); | ||||
| task.log("custom config: server language code = " | task.log("custom config: server language code = " | ||||
| @@ -198,16 +198,15 @@ public class Symlink extends DispatchTask { | |||||
| public void recreate() throws BuildException { | public void recreate() throws BuildException { | ||||
| try { | try { | ||||
| if (fileSets.isEmpty()) { | if (fileSets.isEmpty()) { | ||||
| handleError( | |||||
| "File set identifying link file(s) required for action recreate"); | |||||
| handleError("File set identifying link file(s) required for action recreate"); | |||||
| return; | return; | ||||
| } | } | ||||
| final Properties links = loadLinks(fileSets); | final Properties links = loadLinks(fileSets); | ||||
| for (final String lnk : links.stringPropertyNames()) { | for (final String lnk : links.stringPropertyNames()) { | ||||
| final String res = links.getProperty(lnk); | final String res = links.getProperty(lnk); | ||||
| try { | try { | ||||
| if (Files.isSymbolicLink(Paths.get(lnk)) && | |||||
| new File(lnk).getCanonicalPath().equals(new File(res).getCanonicalPath())) { | |||||
| if (Files.isSymbolicLink(Paths.get(lnk)) | |||||
| && new File(lnk).getCanonicalPath().equals(new File(res).getCanonicalPath())) { | |||||
| // it's already a symlink and the symlink target is the same | // it's already a symlink and the symlink target is the same | ||||
| // as the target noted in the properties file. So there's no | // as the target noted in the properties file. So there's no | ||||
| // need to recreate it | // need to recreate it | ||||
| @@ -216,7 +215,8 @@ public class Symlink extends DispatchTask { | |||||
| continue; | continue; | ||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| final String errMessage = "Failed to check if path " + lnk + " is a symbolic link, linking to " + res; | |||||
| final String errMessage = "Failed to check if path " + lnk | |||||
| + " is a symbolic link, linking to " + res; | |||||
| if (failonerror) { | if (failonerror) { | ||||
| throw new BuildException(errMessage, e); | throw new BuildException(errMessage, e); | ||||
| } | } | ||||
| @@ -351,10 +351,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
| attributes.log("Compilation " + cmd.describeArguments(), | attributes.log("Compilation " + cmd.describeArguments(), | ||||
| Project.MSG_VERBOSE); | Project.MSG_VERBOSE); | ||||
| String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + | |||||
| " to be compiled:" + | |||||
| compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) | |||||
| .collect(Collectors.joining(" ")); | |||||
| String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + " to be compiled:" | |||||
| + compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) | |||||
| .collect(Collectors.joining(" ")); | |||||
| attributes.log(niceSourceList, Project.MSG_VERBOSE); | attributes.log(niceSourceList, Project.MSG_VERBOSE); | ||||
| } | } | ||||
| @@ -493,8 +493,8 @@ public class TarUtils { | |||||
| final long max = 1L << bits; | final long max = 1L << bits; | ||||
| long val = Math.abs(value); | long val = Math.abs(value); | ||||
| if (val >= max) { | if (val >= max) { | ||||
| throw new IllegalArgumentException("Value " + value + | |||||
| " is too large for " + length + " byte field."); | |||||
| throw new IllegalArgumentException("Value " + value | |||||
| + " is too large for " + length + " byte field."); | |||||
| } | } | ||||
| if (negative) { | if (negative) { | ||||
| val ^= max - 1; | val ^= max - 1; | ||||
| @@ -60,8 +60,8 @@ public class ExecStreamRedirectorTest { | |||||
| if (dirListingOutput != null) { | if (dirListingOutput != null) { | ||||
| // Compare the directory listing that was redirected to these files. | // Compare the directory listing that was redirected to these files. | ||||
| // All files should have the same content. | // All files should have the same content. | ||||
| assertTrue("Redirected output in file " + redirectedOutputFile + | |||||
| " doesn't match content in other redirected output file(s)", | |||||
| assertTrue("Redirected output in file " + redirectedOutputFile | |||||
| + " doesn't match content in other redirected output file(s)", | |||||
| Arrays.equals(dirListingOutput, redirectedOutput)); | Arrays.equals(dirListingOutput, redirectedOutput)); | ||||
| } | } | ||||
| dirListingOutput = redirectedOutput; | dirListingOutput = redirectedOutput; | ||||
| @@ -102,7 +102,8 @@ public class JUnitLauncherTaskTest { | |||||
| final Path trackerFile = setupTrackerProperty(targetName); | final Path trackerFile = setupTrackerProperty(targetName); | ||||
| buildRule.executeTarget(targetName); | buildRule.executeTarget(targetName); | ||||
| // make sure the right test(s) were run | // make sure the right test(s) were run | ||||
| Assert.assertTrue("JUnit4SampleTest test was expected to be run", wasTestRun(trackerFile, JUnit4SampleTest.class.getName())); | |||||
| Assert.assertTrue("JUnit4SampleTest test was expected to be run", wasTestRun(trackerFile, | |||||
| JUnit4SampleTest.class.getName())); | |||||
| Assert.assertTrue("JUnit4SampleTest#testFoo was expected to succeed", verifySuccess(trackerFile, | Assert.assertTrue("JUnit4SampleTest#testFoo was expected to succeed", verifySuccess(trackerFile, | ||||
| JUnit4SampleTest.class.getName(), "testFoo")); | JUnit4SampleTest.class.getName(), "testFoo")); | ||||
| } | } | ||||
| @@ -169,7 +170,8 @@ public class JUnitLauncherTaskTest { | |||||
| JupiterSampleTest.class.getName(), "testFails")); | JupiterSampleTest.class.getName(), "testFails")); | ||||
| Assert.assertTrue("JupiterSampleTest#testSkipped was expected to be skipped", verifySkipped(trackerFile, | Assert.assertTrue("JupiterSampleTest#testSkipped was expected to be skipped", verifySkipped(trackerFile, | ||||
| JupiterSampleTest.class.getName(), "testSkipped")); | JupiterSampleTest.class.getName(), "testSkipped")); | ||||
| Assert.assertFalse("ForkedTest wasn't expected to be run", wasTestRun(trackerFile, ForkedTest.class.getName())); | |||||
| Assert.assertFalse("ForkedTest wasn't expected to be run", wasTestRun(trackerFile, | |||||
| ForkedTest.class.getName())); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -192,9 +194,9 @@ public class JUnitLauncherTaskTest { | |||||
| } | } | ||||
| /** | /** | ||||
| * Tests that in a forked mode execution of tests, when the {@code includeJUnitPlatformLibraries} attribute | |||||
| * is set to false, then the execution of such tests fails with a classloading error for the JUnit platform | |||||
| * classes | |||||
| * Tests that in a forked mode execution of tests, when the {@code includeJUnitPlatformLibraries} | |||||
| * attribute is set to false, then the execution of such tests fails with a classloading error | |||||
| * for the JUnit platform classes | |||||
| * | * | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @@ -203,8 +205,8 @@ public class JUnitLauncherTaskTest { | |||||
| final String targetName = "test-junit-platform-lib-excluded"; | final String targetName = "test-junit-platform-lib-excluded"; | ||||
| try { | try { | ||||
| buildRule.executeTarget(targetName); | buildRule.executeTarget(targetName); | ||||
| Assert.fail(targetName + " was expected to fail since JUnit platform libraries " + | |||||
| "weren't included in the classpath of the forked JVM"); | |||||
| Assert.fail(targetName + " was expected to fail since JUnit platform libraries " | |||||
| + "weren't included in the classpath of the forked JVM"); | |||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| // expect a ClassNotFoundException for a JUnit platform class | // expect a ClassNotFoundException for a JUnit platform class | ||||
| final String cnfeMessage = ClassNotFoundException.class.getName() + ": org.junit.platform"; | final String cnfeMessage = ClassNotFoundException.class.getName() + ": org.junit.platform"; | ||||
| @@ -213,13 +215,14 @@ public class JUnitLauncherTaskTest { | |||||
| } | } | ||||
| } | } | ||||
| final String exclusionLogMsg = "Excluding JUnit platform libraries"; | final String exclusionLogMsg = "Excluding JUnit platform libraries"; | ||||
| Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", | |||||
| buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| } | } | ||||
| /** | /** | ||||
| * Tests that in a forked mode execution of tests, when the {@code includeAntRuntimeLibraries} attribute | |||||
| * is set to false, then the execution of such tests fails with a classloading error for the Ant runtime | |||||
| * classes | |||||
| * Tests that in a forked mode execution of tests, when the {@code includeAntRuntimeLibraries} | |||||
| * attribute is set to false, then the execution of such tests fails with a classloading error | |||||
| * for the Ant runtime classes | |||||
| * | * | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @@ -228,8 +231,8 @@ public class JUnitLauncherTaskTest { | |||||
| final String targetName = "test-junit-ant-runtime-lib-excluded"; | final String targetName = "test-junit-ant-runtime-lib-excluded"; | ||||
| try { | try { | ||||
| buildRule.executeTarget(targetName); | buildRule.executeTarget(targetName); | ||||
| Assert.fail(targetName + " was expected to fail since JUnit platform libraries " + | |||||
| "weren't included in the classpath of the forked JVM"); | |||||
| Assert.fail(targetName + " was expected to fail since JUnit platform libraries " | |||||
| + "weren't included in the classpath of the forked JVM"); | |||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| // expect a Error due to missing main class (which is part of Ant runtime libraries | // expect a Error due to missing main class (which is part of Ant runtime libraries | ||||
| // that we excluded) | // that we excluded) | ||||
| @@ -239,13 +242,15 @@ public class JUnitLauncherTaskTest { | |||||
| } | } | ||||
| } | } | ||||
| final String exclusionLogMsg = "Excluding Ant runtime libraries"; | final String exclusionLogMsg = "Excluding Ant runtime libraries"; | ||||
| Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", | |||||
| buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| } | } | ||||
| /** | /** | ||||
| * Tests that in a forked mode execution, with {@code includeJUnitPlatformLibraries} attribute set to false | |||||
| * and with the test classpath explicitly including JUnit platform library jars, the tests are executed successfully | |||||
| * Tests that in a forked mode execution, with {@code includeJUnitPlatformLibraries} attribute | |||||
| * set to false and with the test classpath explicitly including JUnit platform library jars, | |||||
| * the tests are executed successfully | |||||
| * | * | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @@ -255,7 +260,8 @@ public class JUnitLauncherTaskTest { | |||||
| final Path trackerFile = setupTrackerProperty(targetName); | final Path trackerFile = setupTrackerProperty(targetName); | ||||
| buildRule.executeTarget(targetName); | buildRule.executeTarget(targetName); | ||||
| final String exclusionLogMsg = "Excluding JUnit platform libraries"; | final String exclusionLogMsg = "Excluding JUnit platform libraries"; | ||||
| Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", | |||||
| buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| Assert.assertTrue("JupiterSampleTest#testSucceeds was expected to succeed", verifySuccess(trackerFile, | Assert.assertTrue("JupiterSampleTest#testSucceeds was expected to succeed", verifySuccess(trackerFile, | ||||
| JupiterSampleTest.class.getName(), "testSucceeds")); | JupiterSampleTest.class.getName(), "testSucceeds")); | ||||
| Assert.assertTrue("JupiterSampleTest#testFails was expected to fail", verifyFailed(trackerFile, | Assert.assertTrue("JupiterSampleTest#testFails was expected to fail", verifyFailed(trackerFile, | ||||
| @@ -263,8 +269,9 @@ public class JUnitLauncherTaskTest { | |||||
| } | } | ||||
| /** | /** | ||||
| * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} attribute set to false | |||||
| * and with the test classpath explicitly including Ant runtime library jars, the tests are executed successfully | |||||
| * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} attribute | |||||
| * set to false and with the test classpath explicitly including Ant runtime library jars, | |||||
| * the tests are executed successfully | |||||
| * | * | ||||
| * @throws Exception | * @throws Exception | ||||
| */ | */ | ||||
| @@ -281,7 +288,8 @@ public class JUnitLauncherTaskTest { | |||||
| // run the target | // run the target | ||||
| buildRule.executeTarget(targetName); | buildRule.executeTarget(targetName); | ||||
| final String exclusionLogMsg = "Excluding Ant runtime libraries"; | final String exclusionLogMsg = "Excluding Ant runtime libraries"; | ||||
| Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", | |||||
| buildRule.getFullLog().contains(exclusionLogMsg)); | |||||
| Assert.assertTrue("JupiterSampleTest#testSucceeds was expected to succeed", verifySuccess(trackerFile, | Assert.assertTrue("JupiterSampleTest#testSucceeds was expected to succeed", verifySuccess(trackerFile, | ||||
| JupiterSampleTest.class.getName(), "testSucceeds")); | JupiterSampleTest.class.getName(), "testSucceeds")); | ||||
| Assert.assertTrue("JupiterSampleTest#testFails was expected to fail", verifyFailed(trackerFile, | Assert.assertTrue("JupiterSampleTest#testFails was expected to fail", verifyFailed(trackerFile, | ||||
| @@ -295,8 +303,9 @@ public class JUnitLauncherTaskTest { | |||||
| } | } | ||||
| /** | /** | ||||
| * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} and {@code includeJUnitPlatformLibraries} | |||||
| * attributes set to false and with the test classpath explicitly including Ant runtime and JUnit platform library jars, | |||||
| * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} and | |||||
| * {@code includeJUnitPlatformLibraries} attributes set to false and with the test classpath | |||||
| * explicitly including Ant runtime and JUnit platform library jars, | |||||
| * the tests are executed successfully | * the tests are executed successfully | ||||
| * | * | ||||
| * @throws Exception | * @throws Exception | ||||
| @@ -92,12 +92,12 @@ public class XMLCatalogTest { | |||||
| @Test | @Test | ||||
| public void testEmptyCatalogResolve() throws TransformerException, MalformedURLException { | public void testEmptyCatalogResolve() throws TransformerException, MalformedURLException { | ||||
| String expected = toURLString(new File(project.getBaseDir() + | |||||
| "/i/dont/exist.dtd")); | |||||
| String expected = toURLString(new File(project.getBaseDir() | |||||
| + "/i/dont/exist.dtd")); | |||||
| Source result = catalog.resolve("i/dont/exist.dtd", null); | Source result = catalog.resolve("i/dont/exist.dtd", null); | ||||
| String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result); | String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result); | ||||
| assertThat("Empty catalog should return input with a system ID like " | assertThat("Empty catalog should return input with a system ID like " | ||||
| + expected + " but was " + resultStr, expected, endsWith(resultStr)); | |||||
| + expected + " but was " + resultStr, expected, endsWith(resultStr)); | |||||
| } | } | ||||
| private static String fileURLPartWithoutLeadingSlashes(SAXSource result) | private static String fileURLPartWithoutLeadingSlashes(SAXSource result) | ||||
| @@ -130,8 +130,7 @@ public class XMLCatalogTest { | |||||
| + "/i/dont/exist.dtd")); | + "/i/dont/exist.dtd")); | ||||
| String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result); | String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result); | ||||
| assertThat("Nonexistent Catalog entry return input with a system ID like " | assertThat("Nonexistent Catalog entry return input with a system ID like " | ||||
| + expected + " but was " + resultStr, | |||||
| expected, endsWith(resultStr)); | |||||
| + expected + " but was " + resultStr, expected, endsWith(resultStr)); | |||||
| } | } | ||||
| @Test | @Test | ||||
| @@ -165,10 +165,10 @@ public abstract class RegexpMatcherTest { | |||||
| @Test | @Test | ||||
| public void testMultiVersusSingleLine() { | public void testMultiVersusSingleLine() { | ||||
| String text = "Line1" + UNIX_LINE + | |||||
| "starttest Line2" + UNIX_LINE + | |||||
| "Line3 endtest" + UNIX_LINE + | |||||
| "Line4" + UNIX_LINE; | |||||
| String text = "Line1" + UNIX_LINE | |||||
| + "starttest Line2" + UNIX_LINE | |||||
| + "Line3 endtest" + UNIX_LINE | |||||
| + "Line4" + UNIX_LINE; | |||||
| doStartTest1(text); | doStartTest1(text); | ||||
| doStartTest2(text); | doStartTest2(text); | ||||