Browse Source

Checkstyle: dangling operators

master
Gintas Grigelionis 6 years ago
parent
commit
2977bb596c
19 changed files with 98 additions and 98 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/AntClassLoader.java
  2. +2
    -2
      src/main/org/apache/tools/ant/DirectoryScanner.java
  3. +2
    -4
      src/main/org/apache/tools/ant/Main.java
  4. +2
    -4
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java
  5. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  6. +12
    -12
      src/main/org/apache/tools/ant/taskdefs/Java.java
  7. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
  8. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
  9. +3
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  10. +8
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java
  11. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java
  12. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java
  13. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
  14. +3
    -4
      src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  15. +2
    -2
      src/main/org/apache/tools/tar/TarUtils.java
  16. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java
  17. +31
    -22
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java
  18. +4
    -5
      src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
  19. +4
    -4
      src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java

+ 3
- 3
src/main/org/apache/tools/ant/AntClassLoader.java View File

@@ -127,7 +127,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
* enumeration; <code>false</code> otherwise.
*/
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) {
// ignore path elements which are invalid
// 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);
}
}
}


+ 2
- 2
src/main/org/apache/tools/ant/DirectoryScanner.java View File

@@ -1245,8 +1245,8 @@ public class DirectoryScanner
continue;
}
} 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();


+ 2
- 4
src/main/org/apache/tools/ant/Main.java View File

@@ -1066,10 +1066,8 @@ public class Main implements AntMain {
props.load(in);
in.close();
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) {
throw new BuildException("Could not load the version information:"
+ ioe.getMessage());


+ 2
- 4
src/main/org/apache/tools/ant/helper/ProjectHelper2.java View File

@@ -1019,10 +1019,8 @@ public class ProjectHelper2 extends ProjectHelper {
project.addOrReplaceTarget(newName, newTarget);
}
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) {
ProjectHelper helper =


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -819,12 +819,12 @@ public class Delete extends MatchingTask {
boolean isFsLoop = false;

try {
isFsLoop = Files.isSymbolicLink(f.toPath()) &&
FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(),
isFsLoop = Files.isSymbolicLink(f.toPath())
&& FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(),
d.getAbsoluteFile(), true);
} 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) {


+ 12
- 12
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -53,6 +53,12 @@ public class Java extends Task {
private static final String TIMEOUT_MESSAGE =
"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 Environment env = new Environment();
private boolean fork = false;
@@ -365,8 +371,7 @@ public class Java extends Task {
public void setJar(File jarfile) throws BuildException {
if (getCommandLine().getClassname() != null || getCommandLine().getModule() != 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());
}
@@ -380,8 +385,7 @@ public class Java extends Task {
*/
public void setClassname(String s) throws BuildException {
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);
}
@@ -396,8 +400,7 @@ public class Java extends Task {
*/
public void setModule(String module) throws BuildException {
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);
}
@@ -412,12 +415,9 @@ public class Java extends Task {
* @since Ant 1.10.5
*/
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);
}


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java View File

@@ -111,8 +111,7 @@ public class MimeMailer extends Mailer {
return type;
}
// 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


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java View File

@@ -83,15 +83,15 @@ public class JavahAdapterFactory {
Path classpath)
throws BuildException {
if ((JavaEnvUtils.isKaffe() && choice == null)
|| Kaffeh.IMPLEMENTATION_NAME.equals(choice)) {
|| Kaffeh.IMPLEMENTATION_NAME.equals(choice)) {
return new Kaffeh();
}
if ((JavaEnvUtils.isGij() && choice == null)
|| Gcjh.IMPLEMENTATION_NAME.equals(choice)) {
|| Gcjh.IMPLEMENTATION_NAME.equals(choice)) {
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,"
+ " use the javac task with nativeHeaderDir instead");
}


+ 3
- 8
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -2067,8 +2067,7 @@ public class JUnitTask extends Task {
*/
@Override
public boolean equals(final Object other) {
if (other == null
|| other.getClass() != ForkedTestConfiguration.class) {
if (other == null || other.getClass() != ForkedTestConfiguration.class) {
return false;
}
final ForkedTestConfiguration o = (ForkedTestConfiguration) other;
@@ -2076,13 +2075,9 @@ public class JUnitTask extends Task {
&& haltOnError == o.haltOnError
&& haltOnFailure == o.haltOnFailure
&& ((errorProperty == null && o.errorProperty == null)
||
(errorProperty != null
&& errorProperty.equals(o.errorProperty)))
|| (errorProperty != null && errorProperty.equals(o.errorProperty)))
&& ((failureProperty == null && o.failureProperty == null)
||
(failureProperty != null
&& failureProperty.equals(o.failureProperty)));
|| (failureProperty != null && failureProperty.equals(o.failureProperty)));
}

/**


+ 8
- 5
src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java View File

@@ -206,8 +206,8 @@ public class LauncherSupport {
final Optional<Project> project = this.testExecutionContext.getProject();
for (final ListenerDefinition applicableListener : applicableListenerElements) {
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;
}
final TestExecutionListener listener = requireTestExecutionListener(applicableListener, classLoader);
@@ -274,7 +274,8 @@ public class LauncherSupport {
throw new BuildException("Failed to load listener class " + className, e);
}
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 {
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
final String errorMessage;
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 {
errorMessage = "Some test(s) have failure(s)";
}
@@ -366,7 +368,8 @@ public class LauncherSupport {
final Thread sysErrStreamer = new Thread(streamer);
sysErrStreamer.setDaemon(true);
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();
break;
}


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java View File

@@ -87,8 +87,8 @@ public class JUnitLauncherTask extends Task {
final Project project = getProject();
for (final TestDefinition test : this.tests) {
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;
}
if (test.getForkDefinition() != null) {
@@ -214,8 +214,8 @@ public class JUnitLauncherTask extends Task {
try {
projectPropsPath = dumpProjectProperties();
} 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>
commandlineJava.createArgument().setValue(Constants.ARG_PROPERTIES);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java View File

@@ -72,8 +72,8 @@ class FTPConfigurator {
if (!serverLanguageCodeConfig.isEmpty()
&& !FTPClientConfig.getSupportedLanguageCodes()
.contains(serverLanguageCodeConfig)) {
throw new BuildException("unsupported language code" +
serverLanguageCodeConfig);
throw new BuildException("unsupported language code"
+ serverLanguageCodeConfig);
}
config.setServerLanguageCode(serverLanguageCodeConfig);
task.log("custom config: server language code = "


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -198,16 +198,15 @@ public class Symlink extends DispatchTask {
public void recreate() throws BuildException {
try {
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;
}
final Properties links = loadLinks(fileSets);
for (final String lnk : links.stringPropertyNames()) {
final String res = links.getProperty(lnk);
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
// as the target noted in the properties file. So there's no
// need to recreate it
@@ -216,7 +215,8 @@ public class Symlink extends DispatchTask {
continue;
}
} 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) {
throw new BuildException(errMessage, e);
}


+ 3
- 4
src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java View File

@@ -351,10 +351,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter {
attributes.log("Compilation " + cmd.describeArguments(),
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);
}



+ 2
- 2
src/main/org/apache/tools/tar/TarUtils.java View File

@@ -493,8 +493,8 @@ public class TarUtils {
final long max = 1L << bits;
long val = Math.abs(value);
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) {
val ^= max - 1;


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java View File

@@ -60,8 +60,8 @@ public class ExecStreamRedirectorTest {
if (dirListingOutput != null) {
// Compare the directory listing that was redirected to these files.
// 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));
}
dirListingOutput = redirectedOutput;


+ 31
- 22
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java View File

@@ -102,7 +102,8 @@ public class JUnitLauncherTaskTest {
final Path trackerFile = setupTrackerProperty(targetName);
buildRule.executeTarget(targetName);
// 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,
JUnit4SampleTest.class.getName(), "testFoo"));
}
@@ -169,7 +170,8 @@ public class JUnitLauncherTaskTest {
JupiterSampleTest.class.getName(), "testFails"));
Assert.assertTrue("JupiterSampleTest#testSkipped was expected to be skipped", verifySkipped(trackerFile,
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
*/
@@ -203,8 +205,8 @@ public class JUnitLauncherTaskTest {
final String targetName = "test-junit-platform-lib-excluded";
try {
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) {
// expect a ClassNotFoundException for a JUnit platform class
final String cnfeMessage = ClassNotFoundException.class.getName() + ": org.junit.platform";
@@ -213,13 +215,14 @@ public class JUnitLauncherTaskTest {
}
}
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
*/
@@ -228,8 +231,8 @@ public class JUnitLauncherTaskTest {
final String targetName = "test-junit-ant-runtime-lib-excluded";
try {
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) {
// expect a Error due to missing main class (which is part of Ant runtime libraries
// that we excluded)
@@ -239,13 +242,15 @@ public class JUnitLauncherTaskTest {
}
}
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
*/
@@ -255,7 +260,8 @@ public class JUnitLauncherTaskTest {
final Path trackerFile = setupTrackerProperty(targetName);
buildRule.executeTarget(targetName);
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,
JupiterSampleTest.class.getName(), "testSucceeds"));
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
*/
@@ -281,7 +288,8 @@ public class JUnitLauncherTaskTest {
// run the target
buildRule.executeTarget(targetName);
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,
JupiterSampleTest.class.getName(), "testSucceeds"));
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
*
* @throws Exception


+ 4
- 5
src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java View File

@@ -92,12 +92,12 @@ public class XMLCatalogTest {

@Test
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);
String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result);
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)
@@ -130,8 +130,7 @@ public class XMLCatalogTest {
+ "/i/dont/exist.dtd"));
String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result);
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


+ 4
- 4
src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java View File

@@ -165,10 +165,10 @@ public abstract class RegexpMatcherTest {

@Test
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);
doStartTest2(text);


Loading…
Cancel
Save