You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2017/12/01 20:48:57 UTC
[4/6] ant git commit: Checkstyle: mostly whitespace
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
index 14c1c56..bf8f28d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
@@ -20,8 +20,8 @@ package org.apache.tools.ant.taskdefs;
import java.lang.reflect.Method;
-import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.TypeAdapter;
@@ -116,8 +116,7 @@ public class TypeAdapterTest {
}
public static class RunnableAdapter
- extends Task implements TypeAdapter
- {
+ extends Task implements TypeAdapter {
private String execMethodName = "run";
private Object proxy;
@@ -128,14 +127,12 @@ public class TypeAdapterTest {
String message =
"return type of " + execMethodName + "() should be "
+ "void but was \"" + execMethod.getReturnType() +
- "\" in "
- + proxyClass;
+ "\" in " + proxyClass;
log(message, Project.MSG_WARN);
}
return execMethod;
} catch (NoSuchMethodException e) {
- String message = "No public "+ execMethodName +
- "() method in "
+ String message = "No public " + execMethodName + "() method in "
+ proxyClass;
log(message, Project.MSG_ERR);
throw new BuildException(message);
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
index 242f7c6..0b93826 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TypedefTest.java
@@ -113,7 +113,7 @@ public class TypedefTest {
}
@Test
- public void testNoResourceOnErrorFailAll(){
+ public void testNoResourceOnErrorFailAll() {
try {
buildRule.executeTarget("noresourcefailall");
fail("BuildException expected: the requested resource does not exist");
@@ -123,13 +123,13 @@ public class TypedefTest {
}
@Test
- public void testNoResourceOnErrorFail(){
+ public void testNoResourceOnErrorFail() {
buildRule.executeTarget("noresourcefail");
assertContains("Could not load definitions from resource ", buildRule.getLog());
}
@Test
- public void testNoResourceOnErrorNotFail(){
+ public void testNoResourceOnErrorNotFail() {
buildRule.executeTarget("noresourcenotfail");
assertContains("Could not load definitions from resource ", buildRule.getLog());
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java
index e0f7eb2..ea0c60c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java
@@ -25,6 +25,7 @@ import org.junit.Rule;
import org.junit.Test;
import java.io.File;
+import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -43,32 +44,32 @@ public class UntarTest {
}
@Test
- public void testRealTest() throws java.io.IOException {
+ public void testRealTest() throws IOException {
testLogoExtraction("realTest");
}
@Test
- public void testRealGzipTest() throws java.io.IOException {
+ public void testRealGzipTest() throws IOException {
testLogoExtraction("realGzipTest");
}
@Test
- public void testRealBzip2Test() throws java.io.IOException {
+ public void testRealBzip2Test() throws IOException {
testLogoExtraction("realBzip2Test");
}
@Test
- public void testTestTarTask() throws java.io.IOException {
+ public void testTestTarTask() throws IOException {
testLogoExtraction("testTarTask");
}
@Test
- public void testTestGzipTarTask() throws java.io.IOException {
+ public void testTestGzipTarTask() throws IOException {
testLogoExtraction("testGzipTarTask");
}
@Test
- public void testTestBzip2TarTask() throws java.io.IOException {
+ public void testTestBzip2TarTask() throws IOException {
testLogoExtraction("testBzip2TarTask");
}
@@ -91,11 +92,11 @@ public class UntarTest {
}
@Test
- public void testResourceCollection() throws java.io.IOException {
+ public void testResourceCollection() throws IOException {
testLogoExtraction("resourceCollection");
}
- private void testLogoExtraction(String target) throws java.io.IOException {
+ private void testLogoExtraction(String target) throws IOException {
buildRule.executeTarget(target);
assertEquals(FileUtilities.getFileContents(buildRule.getProject().resolveFile("../asf-logo.gif")),
FileUtilities.getFileContents(new File(buildRule.getProject().getProperty("output"), "untar/asf-logo.gif")));
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
index 1997561..661d6e9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java
@@ -74,14 +74,14 @@ public class UnzipTest {
@Test
- public void testRealTest() throws java.io.IOException {
+ public void testRealTest() throws IOException {
buildRule.executeTarget("realTest");
assertLogoUncorrupted();
}
/**
* test that the logo gif file has not been corrupted
- * @throws IOException
+ * @throws IOException if something goes wrong
*/
private void assertLogoUncorrupted() throws IOException {
assertEquals(FileUtilities.getFileContents(buildRule.getProject().resolveFile("../asf-logo.gif")),
@@ -90,13 +90,13 @@ public class UnzipTest {
}
@Test
- public void testTestZipTask() throws java.io.IOException {
+ public void testTestZipTask() throws IOException {
buildRule.executeTarget("testZipTask");
assertLogoUncorrupted();
}
@Test
- public void testTestUncompressedZipTask() throws java.io.IOException {
+ public void testTestUncompressedZipTask() throws IOException {
buildRule.executeTarget("testUncompressedZipTask");
assertLogoUncorrupted();
}
@@ -204,7 +204,7 @@ public class UnzipTest {
}
/**
- * assert that a file doesnt exist, relative to the project
+ * assert that a file doesn't exist, relative to the project
*
* @param message message if there is no mpatch
* @param filename filename to resolve against the project
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
index 4428b93..97a3c8c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UpToDateTest.java
@@ -43,7 +43,7 @@ public class UpToDateTest {
File srcDir = buildRule.getProject().resolveFile("source");
assumeTrue("Could not change modification timestamp of source directory",
srcDir.setLastModified(srcDir.lastModified()
- - (3 * FileUtils.getFileUtils().getFileTimestampGranularity())));
+ - 3 * FileUtils.getFileUtils().getFileTimestampGranularity()));
}
@After
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
index 8906917..1cb722f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
@@ -79,7 +79,7 @@ public class XmlPropertyTest {
}
@Test
- public void testNone () throws IOException {
+ public void testNone() throws IOException {
doTest("testNone", false, false, false, false, false);
}
@@ -89,47 +89,47 @@ public class XmlPropertyTest {
}
@Test
- public void testCollapse () throws IOException {
+ public void testCollapse() throws IOException {
doTest("testCollapse", false, true, false, false, false);
}
@Test
- public void testSemantic () throws IOException {
+ public void testSemantic() throws IOException {
doTest("testSemantic", false, false, true, false, false);
}
@Test
- public void testKeeprootCollapse () throws IOException {
+ public void testKeeprootCollapse() throws IOException {
doTest("testKeeprootCollapse", true, true, false, false, false);
}
@Test
- public void testKeeprootSemantic () throws IOException {
+ public void testKeeprootSemantic() throws IOException {
doTest("testKeeprootSemantic", true, false, true, false, false);
}
@Test
- public void testCollapseSemantic () throws IOException {
+ public void testCollapseSemantic() throws IOException {
doTest("testCollapseSemantic", false, true, true, false, false);
}
@Test
- public void testKeeprootCollapseSemantic () throws IOException {
+ public void testKeeprootCollapseSemantic() throws IOException {
doTest("testKeeprootCollapseSemantic", true, true, true, false, false);
}
@Test
- public void testInclude () throws IOException {
+ public void testInclude() throws IOException {
doTest("testInclude", false, false, false, true, false);
}
@Test
- public void testSemanticInclude () throws IOException {
+ public void testSemanticInclude() throws IOException {
doTest("testSemanticInclude", false, false, true, true, false);
}
@Test
- public void testSemanticLocal () throws IOException {
+ public void testSemanticLocal() throws IOException {
doTest("testSemanticInclude", false, false, true, false, true);
}
@@ -152,7 +152,7 @@ public class XmlPropertyTest {
// What's the working directory? If local, then its the
// folder of the input file. Otherwise, its the "current" dir..
File workingDir;
- if ( localRoot ) {
+ if (localRoot) {
workingDir = inputFile.getParentFile();
} else {
workingDir = FILE_UTILS.resolveFile(new File("."), ".");
@@ -206,13 +206,13 @@ public class XmlPropertyTest {
* but some other properties may get set in the XmlProperty due
* to generic Project/Task configuration.
*/
- private static void ensureProperties (String msg, File inputFile,
+ private static void ensureProperties(String msg, File inputFile,
File workingDir, Project p,
Properties properties) {
Hashtable xmlproperties = p.getProperties();
// Every key identified by the Properties must have been loaded.
- Enumeration propertyKeyEnum = properties.propertyNames();
- while(propertyKeyEnum.hasMoreElements()){
+ Enumeration<?> propertyKeyEnum = properties.propertyNames();
+ while (propertyKeyEnum.hasMoreElements()) {
String currentKey = propertyKeyEnum.nextElement().toString();
String assertMsg = msg + "-" + inputFile.getName()
+ " Key=" + currentKey;
@@ -227,10 +227,9 @@ public class XmlPropertyTest {
// that the object was created with the given id.
// We don't have an adequate way of testing the actual
// *value* of the Path object, though...
- String id = currentKey;
- Object obj = p.getReferences().get(id);
+ Object obj = p.getReferences().get(currentKey);
- if ( obj == null ) {
+ if (obj == null) {
fail(assertMsg + " Object ID does not exist.");
}
@@ -286,13 +285,10 @@ public class XmlPropertyTest {
String currentKey = referenceKeyEnum.nextElement().toString();
Object currentValue = references.get(currentKey);
- if (currentValue instanceof Path) {
- } else if (currentValue instanceof String) {
- } else {
- if( ! currentKey.startsWith("ant.") ) {
- fail(msg + "-" + inputFile.getName() + " Key="
- + currentKey + " is not a recognized type.");
- }
+ if (!(currentValue instanceof Path) && !(currentValue instanceof String)
+ && !currentKey.startsWith("ant.")) {
+ fail(msg + "-" + inputFile.getName() + " Key="
+ + currentKey + " is not a recognized type.");
}
}
}
@@ -301,7 +297,7 @@ public class XmlPropertyTest {
* Munge the name of the input file to find an appropriate goldfile,
* based on hardwired naming conventions.
*/
- private static File getGoldfile (File input, boolean keepRoot,
+ private static File getGoldfile(File input, boolean keepRoot,
boolean collapse, boolean semantic,
boolean include, boolean localRoot) {
// Substitute .xml with .properties
@@ -358,14 +354,13 @@ public class XmlPropertyTest {
return true;
} else {
return (file.getPath().indexOf("taskdefs") > 0 &&
- file.getPath().toLowerCase().endsWith(".xml") );
+ file.getPath().toLowerCase().endsWith(".xml"));
}
}
};
File[] files = startingDir.listFiles(filter);
- for (int i=0;i<files.length;i++) {
- File f = files[i];
+ for (File f : files) {
if (!f.isDirectory()) {
collect.addElement(f);
} else {
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/ZipExtraFieldTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipExtraFieldTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipExtraFieldTest.java
index c5a4216..ff3b0e4 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipExtraFieldTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipExtraFieldTest.java
@@ -20,13 +20,12 @@ package org.apache.tools.ant.taskdefs;
import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Collections;
import java.util.Iterator;
import org.apache.tools.ant.types.Resource;
-
import org.apache.tools.ant.types.ResourceCollection;
import org.apache.tools.ant.types.resources.ZipResource;
import org.apache.tools.zip.JarMarker;
@@ -82,8 +81,12 @@ public class ZipExtraFieldTest {
}
};
testInstance.add(new ResourceCollection() {
- public boolean isFilesystemOnly() { return false; }
- public int size() { return 1; }
+ public boolean isFilesystemOnly() {
+ return false;
+ }
+ public int size() {
+ return 1;
+ }
public Iterator<Resource> iterator() {
return Collections.<Resource>singleton(r).iterator();
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
index d1340b5..276157d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java
@@ -101,7 +101,7 @@ public class ZipTest {
@After
public void tearDown() {
try {
- if ( zfPrefixAddsDir != null) {
+ if (zfPrefixAddsDir != null) {
zfPrefixAddsDir.close();
}
@@ -189,21 +189,25 @@ public class ZipTest {
public void testEmptySkip() {
buildRule.executeTarget("testEmptySkip");
}
+
// Bugzilla Report 30365
@Test
public void testZipEmptyDir() {
buildRule.executeTarget("zipEmptyDir");
}
+
// Bugzilla Report 40258
@Test
public void testZipEmptyDirFilesOnly() {
buildRule.executeTarget("zipEmptyDirFilesOnly");
}
+
@Test
public void testZipEmptyCreate() {
buildRule.executeTarget("zipEmptyCreate");
assertContains("Note: creating empty", buildRule.getLog());
}
+
// Bugzilla Report 25513
@Test
public void testCompressionLevel() {
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
index 63203bf..5595873 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java
@@ -40,7 +40,7 @@ import static org.junit.Assert.assertEquals;
public class DefaultCompilerAdapterTest {
private static class LogCapturingJavac extends Javac {
- private StringBuffer sb = new StringBuffer();
+ private StringBuilder sb = new StringBuilder();
public void log(String msg, int msgLevel) {
sb.append(msg);
}
@@ -58,7 +58,9 @@ public class DefaultCompilerAdapterTest {
return cmd;
}
- public boolean execute() { return false; }
+ public boolean execute() {
+ return false;
+ }
/**
* public to avoid classloader issues.
@@ -70,7 +72,9 @@ public class DefaultCompilerAdapterTest {
private static class SourceTargetHelperNoOverride extends DefaultCompilerAdapter {
- public boolean execute() { return false; }
+ public boolean execute() {
+ return false;
+ }
/**
* public to avoid classloader issues.
@@ -357,6 +361,7 @@ public class DefaultCompilerAdapterTest {
src.mkdir();
final File java1 = createFile(src,"main/m1/lin/classes/org/apache/ant/tests/J1.java");
final File java2 = createFile(src,"main/m3/sol/classes/org/apache/ant/tests/J2.java");
+ @SuppressWarnings("unused")
final File java3 = createFile(src,"main/m3/sol/classes/org/apache/ant/invisible/J3.java");
final File build = new File(workDir, "build");
build.mkdirs();
@@ -501,7 +506,7 @@ public class DefaultCompilerAdapterTest {
final File destDir = new File(tmp, String.format("%s%s%d",
getClass().getName(),
testName,
- System.currentTimeMillis()/1000));
+ System.currentTimeMillis() / 1000));
destDir.mkdirs();
return destDir;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
index d036834..a58fb97 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
@@ -68,7 +68,7 @@ public class IsReachableTest {
try {
buildRule.executeTarget("testBoth");
fail("Build exception expected: error on two targets");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals(IsReachable.ERROR_BOTH_TARGETS, ex.getMessage());
}
}
@@ -78,7 +78,7 @@ public class IsReachableTest {
try {
buildRule.executeTarget("testNoTargets");
fail("Build exception expected: no params");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals(IsReachable.ERROR_NO_HOSTNAME, ex.getMessage());
}
}
@@ -88,7 +88,7 @@ public class IsReachableTest {
try {
buildRule.executeTarget("testBadTimeout");
fail("Build exception expected: error on -ve timeout");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals(IsReachable.ERROR_BAD_TIMEOUT, ex.getMessage());
}
}
@@ -99,7 +99,7 @@ public class IsReachableTest {
try {
buildRule.executeTarget("testFile");
fail("Build exception expected: error on file URL");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals(IsReachable.ERROR_NO_HOST_IN_URL, ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java
index 3dfaf8d..fd065d1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParserTest.java
@@ -20,9 +20,9 @@ package org.apache.tools.ant.taskdefs.cvslib;
import org.junit.Test;
import java.util.Calendar;
+import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
-import java.util.Date;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriterTest.java
index a2531d8..ba464a9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriterTest.java
@@ -17,21 +17,21 @@
*/
package org.apache.tools.ant.taskdefs.cvslib;
-import java.util.Date;
-import java.io.PrintWriter;
-import java.io.OutputStreamWriter;
-import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Date;
import org.apache.tools.ant.util.JAXPUtils;
import org.junit.Test;
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
+import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
/**
* Test for the cvslib ChangeLogWriter
@@ -65,11 +65,12 @@ public class ChangeLogWriterTest {
public void startDocument() throws SAXException {
}
- public void characters(char ch[], int start, int length) throws SAXException {
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ @SuppressWarnings("unused")
String debug = new String(ch, start, length);
}
- public void ignorableWhitespace(char ch[], int start, int length) throws SAXException {
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
}
public void endPrefixMapping(String prefix) throws SAXException {
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/dir2/A.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/dir2/A.java b/src/tests/junit/org/apache/tools/ant/taskdefs/dir2/A.java
index 5186ac4..437e0bc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/dir2/A.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/dir2/A.java
@@ -24,14 +24,14 @@ public class A {
System.out.println(a);
}
- static A a=new A();
+ static A a = new A();
static {
System.out.println("A CLASS INITIALIZATION");
}
protected static void setA(A oa) {
- a=oa;
+ a = oa;
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailAddressTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailAddressTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailAddressTest.java
index 31ecafb..00befcd 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailAddressTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailAddressTest.java
@@ -30,83 +30,83 @@ public class EmailAddressTest {
@Test
public void test1() {
- expectNameAddress( new EmailAddress("address (name)") );
+ expectNameAddress(new EmailAddress("address (name)"));
}
@Test
public void test2() {
- expectNameAddress( new EmailAddress("(name) address") );
+ expectNameAddress(new EmailAddress("(name) address"));
}
@Test
public void test3() {
- expectNameAddress( new EmailAddress("name <address>") );
+ expectNameAddress(new EmailAddress("name <address>"));
}
@Test
public void test4() {
- expectNameAddress( new EmailAddress("<address> name") );
+ expectNameAddress(new EmailAddress("<address> name"));
}
@Test
public void test5() {
- expectNameAddress( new EmailAddress("<address> (name)") );
+ expectNameAddress(new EmailAddress("<address> (name)"));
}
@Test
public void test6() {
- expectNameAddress( new EmailAddress("(name) <address>") );
+ expectNameAddress(new EmailAddress("(name) <address>"));
}
@Test
public void test7() {
- expectNameAddress2( new EmailAddress("address (<name>)") );
+ expectNameAddress2(new EmailAddress("address (<name>)"));
}
@Test
public void test8() {
- expectNameAddress2( new EmailAddress("(<name>) address") );
+ expectNameAddress2(new EmailAddress("(<name>) address"));
}
@Test
public void test9() {
- expectNameAddress3( new EmailAddress("address") );
+ expectNameAddress3(new EmailAddress("address"));
}
@Test
public void testA() {
- expectNameAddress3( new EmailAddress("<address>") );
+ expectNameAddress3(new EmailAddress("<address>"));
}
@Test
public void testB() {
- expectNameAddress3( new EmailAddress(" <address> ") );
+ expectNameAddress3(new EmailAddress(" <address> "));
}
@Test
public void testC() {
- expectNameAddress3( new EmailAddress("< address >") );
+ expectNameAddress3(new EmailAddress("< address >"));
}
@Test
public void testD() {
- expectNameAddress3( new EmailAddress(" < address > ") );
+ expectNameAddress3(new EmailAddress(" < address > "));
}
private void expectNameAddress(EmailAddress e) {
- assertEquals( "name", e.getName() );
- assertEquals( "address", e.getAddress() );
+ assertEquals("name", e.getName());
+ assertEquals("address", e.getAddress());
}
// where the name contains <>
private void expectNameAddress2(EmailAddress e) {
- assertEquals( "<name>", e.getName() );
- assertEquals( "address", e.getAddress() );
+ assertEquals("<name>", e.getName());
+ assertEquals("address", e.getAddress());
}
// where only an address is supplied
private void expectNameAddress3(EmailAddress e) {
assertNull("Expected null, found <" + e.getName() + ">", e.getName());
- assertEquals( "address", e.getAddress() );
+ assertEquals("address", e.getAddress());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
index 9258448..127de51 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ANTLRTest.java
@@ -188,7 +188,7 @@ public class ANTLRTest {
buildRule.executeTarget("test9");
assertNotContains("Skipped grammar file.", buildRule.getFullLog());
- FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
+ FileUtilities.rollbackTimestamps(buildRule.getOutputDir(), 5);
buildRule.executeTarget("normalRecompile");
assertNotContains("Skipped grammar file.", buildRule.getFullLog());
@@ -200,7 +200,7 @@ public class ANTLRTest {
buildRule.executeTarget("test9");
assertNotContains("Skipped grammar file.", buildRule.getFullLog());
- FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
+ FileUtilities.rollbackTimestamps(buildRule.getOutputDir(), 5);
buildRule.executeTarget("supergrammarChangeRecompile");
assertNotContains("Skipped grammar file.", buildRule.getFullLog());
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
index 4e1ee7a..d7dedfc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
import org.w3c.dom.Document;
/**
- * Abtract testcase for XSLTLiaison.
+ * Abstract testcase for XSLTLiaison.
* Override createLiaison for each XSLTLiaison.
*
* <a href="sbailliez@apache.org">Stephane Bailliez</a>
@@ -51,12 +51,12 @@ public abstract class AbstractXSLTLiaisonTest {
}
// to override
- protected abstract XSLTLiaison createLiaison() throws Exception ;
+ protected abstract XSLTLiaison createLiaison() throws Exception;
/** load the file from the caller classloader that loaded this class */
protected File getFile(String name) throws FileNotFoundException {
URL url = getClass().getResource(name);
- if (url == null){
+ if (url == null) {
throw new FileNotFoundException("Unable to load '" + name + "' from classpath");
}
return new File(FILE_UTILS.fromURI(url.toExternalForm()));
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
index 0b301f9..cbd66b6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/EchoPropertiesTest.java
@@ -50,7 +50,7 @@ import org.junit.Test;
*/
public class EchoPropertiesTest {
- private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
+ private static final String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
private static final String GOOD_OUTFILE = "test.properties";
private static final String GOOD_OUTFILE_XML = "test.xml";
private static final String PREFIX_OUTFILE = "test-prefix.properties";
@@ -59,20 +59,17 @@ public class EchoPropertiesTest {
@Rule
public BuildFileRule buildRule = new BuildFileRule();
-
@Before
public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "echoproperties.xml");
buildRule.getProject().setProperty("test.property", TEST_VALUE);
}
-
@After
public void tearDown() {
buildRule.executeTarget("cleanup");
}
-
@Test
public void testEchoToLog() {
buildRule.executeTarget("testEchoToLog");
@@ -82,17 +79,15 @@ public class EchoPropertiesTest {
@Test
public void testEchoWithEmptyPrefixToLog() {
buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
- assertContains("test.property="+TEST_VALUE, buildRule.getLog());
+ assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
}
-
@Test
public void testReadBadFile() {
try {
buildRule.executeTarget("testReadBadFile");
fail("BuildException should have been thrown on bad file");
- }
- catch(BuildException ex) {
+ } catch(BuildException ex) {
assertContains("srcfile is a directory","srcfile is a directory!", ex.getMessage());
}
}
@@ -103,32 +98,28 @@ public class EchoPropertiesTest {
assertContains("srcfile is a directory!", buildRule.getLog());
}
-
@Test
public void testEchoToBadFile() {
try {
buildRule.executeTarget("testEchoToBadFile");
fail("BuildException should have been thrown on destination file being a directory");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertContains("destfile is a directory", "destfile is a directory!", ex.getMessage());
}
}
-
@Test
public void testEchoToBadFileNoFail() {
buildRule.executeTarget("testEchoToBadFileNoFail");
assertContains("destfile is a directory!", buildRule.getLog());
}
-
@Test
public void testEchoToGoodFile() throws Exception {
buildRule.executeTarget("testEchoToGoodFile");
assertGoodFile();
}
-
@Test
public void testEchoToGoodFileXml() throws Exception {
buildRule.executeTarget("testEchoToGoodFileXml");
@@ -149,21 +140,21 @@ public class EchoPropertiesTest {
} finally {
try {
fr.close();
- } catch(IOException e) {}
+ } catch (IOException e) {
+ }
try {
br.close();
- } catch(IOException e) {}
+ } catch (IOException e) {
+ }
}
}
-
@Test
public void testEchoToGoodFileFail() throws Exception {
buildRule.executeTarget("testEchoToGoodFileFail");
assertGoodFile();
}
-
@Test
public void testEchoToGoodFileNoFail() throws Exception {
buildRule.executeTarget("testEchoToGoodFileNoFail");
@@ -194,23 +185,26 @@ public class EchoPropertiesTest {
public void testWithPrefixAndRegex() throws Exception {
try {
buildRule.executeTarget("testWithPrefixAndRegex");
- fail("BuildException should have been thrown on Prefix and RegEx beng set");
+ fail("BuildException should have been thrown on Prefix and RegEx being set");
} catch (BuildException ex) {
- assertEquals("The target must fail with prefix and regex attributes set", "Please specify either prefix or regex, but not both", ex.getMessage());
+ assertEquals("The target must fail with prefix and regex attributes set",
+ "Please specify either prefix or regex, but not both", ex.getMessage());
}
}
@Test
public void testWithEmptyPrefixAndRegex() throws Exception {
buildRule.executeTarget("testEchoWithEmptyPrefixToLog");
- assertContains("test.property="+TEST_VALUE, buildRule.getLog());
+ assertContains("test.property=" + TEST_VALUE, buildRule.getLog());
}
@Test
public void testWithRegex() throws Exception {
- assumeTrue("Test skipped because no regexp matcher is present.", RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
+ assumeTrue("Test skipped because no regexp matcher is present.",
+ RegexpMatcherFactory.regexpMatcherPresent(buildRule.getProject()));
buildRule.executeTarget("testWithRegex");
- // the following line has been changed from checking ant.home to ant.version so the test will still work when run outside of an ant script
+ // the following line has been changed from checking ant.home to ant.version
+ // so the test will still work when run outside of an Ant script
assertContains("ant.version=", buildRule.getFullLog());
}
@@ -226,14 +220,17 @@ public class EchoPropertiesTest {
protected Properties loadPropFile(String relativeFilename)
throws IOException {
File f = createRelativeFile(relativeFilename);
- Properties props=new Properties();
- InputStream in=null;
+ Properties props = new Properties();
+ InputStream in = null;
try {
- in=new BufferedInputStream(new FileInputStream(f));
+ in = new BufferedInputStream(new FileInputStream(f));
props.load(in);
} finally {
- if(in!=null) {
- try { in.close(); } catch(IOException e) {}
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
}
}
return props;
@@ -241,20 +238,18 @@ public class EchoPropertiesTest {
protected void assertGoodFile() throws Exception {
File f = createRelativeFile(GOOD_OUTFILE);
- assertTrue("Did not create "+f.getAbsolutePath(),
+ assertTrue("Did not create " + f.getAbsolutePath(),
f.exists());
- Properties props=loadPropFile(GOOD_OUTFILE);
+ Properties props = loadPropFile(GOOD_OUTFILE);
props.list(System.out);
assertEquals("test property not found ",
TEST_VALUE, props.getProperty("test.property"));
}
-
protected String toAbsolute(String filename) {
return createRelativeFile(filename).getAbsolutePath();
}
-
protected File createRelativeFile(String filename) {
if (filename.equals(".")) {
return buildRule.getProject().getBaseDir();
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
index cde44d0..d1a0f57 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JspcTest.java
@@ -37,15 +37,15 @@ import static org.junit.Assert.fail;
/**
* Tests the Jspc task.
- *
+ * <p>
* created 07 March 2002
+ * </p>
* @since Ant 1.5
*/
public class JspcTest {
private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
-
@Rule
public BuildFileRule buildRule = new BuildFileRule();
@@ -54,26 +54,21 @@ public class JspcTest {
buildRule.configureProject(TASKDEFS_DIR + "jspc.xml");
}
-
-
@Test
public void testSimple() {
executeJspCompile("testSimple", "simple_jsp.java");
}
-
@Test
public void testUriroot() throws Exception {
executeJspCompile("testUriroot", "uriroot_jsp.java");
}
-
@Test
public void testXml() throws Exception {
executeJspCompile("testXml", "xml_jsp.java");
}
-
/**
* try a keyword in a file
*/
@@ -82,7 +77,6 @@ public class JspcTest {
executeJspCompile("testKeyword", "default_jsp.java");
}
-
/**
* what happens to 1nvalid-classname
*/
@@ -92,7 +86,6 @@ public class JspcTest {
"_1nvalid_0002dclassname_jsp.java");
}
-
@Test
public void testNoTld() throws Exception {
try {
@@ -103,7 +96,6 @@ public class JspcTest {
}
}
-
@Test
public void testNotAJspFile() throws Exception {
buildRule.executeTarget("testNotAJspFile");
@@ -130,7 +122,6 @@ public class JspcTest {
assertJavaFileCreated(javafile);
}
-
/**
* verify that a named file was created
*
@@ -157,11 +148,11 @@ public class JspcTest {
*/
@Test
public void testJasperNameManglerSelection() {
- JspCompilerAdapter adapter=
+ JspCompilerAdapter adapter =
JspCompilerAdapterFactory.getCompiler("jasper", null,null);
- JspMangler mangler=adapter.createMangler();
+ JspMangler mangler = adapter.createMangler();
assertTrue(mangler instanceof JspNameMangler);
- adapter= JspCompilerAdapterFactory.getCompiler("jasper41", null, null);
+ adapter = JspCompilerAdapterFactory.getCompiler("jasper41", null, null);
mangler = adapter.createMangler();
assertTrue(mangler instanceof Jasper41Mangler);
}
@@ -184,16 +175,15 @@ public class JspcTest {
/**
* assert our mapping rules
- * @param mangler
- * @param filename
- * @param classname
+ * @param mangler JspMangler
+ * @param filename String
+ * @param classname String
*/
protected void assertMapped(JspMangler mangler, String filename, String classname) {
String mappedname = mangler.mapJspToJavaName(new File(filename));
- assertTrue(filename+" should have mapped to "+classname
- +" but instead mapped to "+mappedname,
+ assertTrue(filename + " should have mapped to " + classname
+ + " but instead mapped to " + mappedname,
classname.equals(mappedname));
}
-
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
index 1e8acc9..748225e 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java
@@ -19,6 +19,7 @@
package org.apache.tools.ant.taskdefs.optional;
import java.io.File;
+import java.io.IOException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.util.FileUtils;
@@ -48,7 +49,7 @@ public class Native2AsciiTest {
}
@Test
- public void testIso8859_1() throws java.io.IOException {
+ public void testIso8859_1() throws IOException {
buildRule.executeTarget("testIso8859-1");
File in = buildRule.getProject().resolveFile("expected/iso8859-1.test");
File out = new File(buildRule.getProject().getProperty("output"), "iso8859-1.test");
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
index d74c798..8b1e081 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
@@ -62,7 +62,7 @@ public class PropertyFileTest {
@Test
public void testNonExistingFile() {
PropertyFile props = new PropertyFile();
- props.setProject( buildRule.getProject() );
+ props.setProject(buildRule.getProject());
File file = new File("this-file-does-not-exist.properties");
props.setFile(file);
assertFalse("Properties file exists before test.", file.exists());
@@ -199,6 +199,7 @@ public class PropertyFileTest {
fos.close();
}
+ @SuppressWarnings("unused")
private static final String
projectFilePath = "src/etc/testcases/taskdefs/optional/propertyfile.xml",
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
index 2c71115..be1685b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ReplaceRegExpTest.java
@@ -24,10 +24,10 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -126,7 +126,7 @@ public class ReplaceRegExpTest {
- (FileUtils.getFileUtils().getFileTimestampGranularity() * 3)));
long ts1 = testFile.lastModified();
buildRule.executeTarget("testPreserve");
- assertEquals(ts1 , testFile.lastModified());
+ assertEquals(ts1, testFile.lastModified());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoScriptTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoScriptTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoScriptTest.java
index b383ca9..f3f7655 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoScriptTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/RhinoScriptTest.java
@@ -81,8 +81,7 @@ public class RhinoScriptTest {
buildRule.executeTarget("useSrcAndEncoding");
fail("should have failed with reader's encoding [" + readerEncoding +
"] different from the writer's encoding [" + buildRule.getProject().getProperty("useSrcAndEncoding.encoding") + "]");
- }
- catch(BuildException e) {
+ } catch (BuildException e) {
assertTrue(e.getMessage().matches("expected <eacute \\[\u00e9]> but was <eacute \\[\u00c3\u00a9]>"));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
index 648e644..d11893a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
@@ -93,7 +93,10 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest
}
});
// Tickle #52382:
- System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+ System.setSecurityManager(new SecurityManager() {
+ public void checkPermission(Permission perm) {
+ }
+ });
liaison.transform(in, out);
} finally {
out.delete();
@@ -123,7 +126,10 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest
File in = getFile("/taskdefs/optional/xsltliaison-in.xsl");
try {
liaison.addParam("xalan-version", "2");
- System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+ System.setSecurityManager(new SecurityManager() {
+ public void checkPermission(Permission perm) {
+ }
+ });
liaison.transform(in, out);
} finally {
out.delete();
@@ -138,11 +144,11 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest
liaison.addParam("param", "value");
File in = getFile("/taskdefs/optional/xsltliaison-in.xml");
// test for 10 consecutives transform
- for (int i = 0; i < 50; i++){
+ for (int i = 0; i < 50; i++) {
File out = new File("xsltliaison" + i + ".tmp");
try {
liaison.transform(in, out);
- } catch (Exception e){
+ } catch (Exception e) {
throw new BuildException("failed in transform " + i, e);
} finally {
out.delete();
@@ -151,9 +157,9 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest
}
@Test
- public void testSystemId(){
+ public void testSystemId() {
File file = null;
- if ( File.separatorChar == '\\' ){
+ if (File.separatorChar == '\\') {
file = new File("d:\\jdk");
} else {
file = new File("/user/local/bin");
@@ -164,7 +170,7 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest
}
public void log(String message) {
- throw new AssertionFailedError("Liaison sent message: "+message);
+ throw new AssertionFailedError("Liaison sent message: " + message);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
index b119f37..15876b1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
@@ -61,8 +61,8 @@ public class DependTest {
buildRule.executeTarget("src1setup");
buildRule.executeTarget("compile");
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
buildRule.executeTarget("testdirect");
Hashtable files = getResultFiles();
@@ -82,8 +82,8 @@ public class DependTest {
buildRule.executeTarget("src1setup");
buildRule.executeTarget("compile");
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
buildRule.executeTarget("testclosure");
Hashtable files = getResultFiles();
@@ -101,8 +101,8 @@ public class DependTest {
buildRule.executeTarget("src2setup");
buildRule.executeTarget("compile");
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
buildRule.executeTarget("testinner");
@@ -119,8 +119,8 @@ public class DependTest {
buildRule.executeTarget("src3setup");
buildRule.executeTarget("compile");
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
buildRule.executeTarget("testinnerinner");
assertEquals("Depend did not leave correct number of files", 0,
@@ -135,7 +135,7 @@ public class DependTest {
try {
buildRule.executeTarget("testnosource");
fail("Build exception expected: No source specified");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertContains("srcdir attribute must be set", ex.getMessage());
}
}
@@ -148,7 +148,7 @@ public class DependTest {
try {
buildRule.executeTarget("testemptysource");
fail("Build exception expected: No source specified");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertContains("srcdir attribute must be non-empty", ex.getMessage());
}
}
@@ -198,8 +198,8 @@ public class DependTest {
buildRule.executeTarget("src5setup");
buildRule.executeTarget("compile");
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
- FileUtilities.rollbackTimetamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("tempsrc.dir")), 5);
+ FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);
buildRule.executeTarget("testnonpublic");
String log = buildRule.getLog();
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
index 812979c..e58e5ce 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
@@ -43,8 +43,6 @@ public class TranslateTest {
private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/i18n/translate";
-
-
@Before
public void setUp() {
buildRule.configureProject(TASKDEFS_DIR + "/translate.xml");
@@ -53,9 +51,11 @@ public class TranslateTest {
@Test
public void test1() throws IOException {
buildRule.executeTarget("test1");
- assertTrue("translation of "+ TASKDEFS_DIR + "/input/template.txt",compareFiles(new File(buildRule.getProject().getBaseDir(), "expected/de/template.txt"),
- new File(buildRule.getOutputDir(), "de/template.txt")));
+ assertTrue("translation of " + TASKDEFS_DIR + "/input/template.txt",
+ compareFiles(new File(buildRule.getProject().getBaseDir(), "expected/de/template.txt"),
+ new File(buildRule.getOutputDir(), "de/template.txt")));
}
+
private boolean compareFiles(File file1, File file2) throws IOException {
if (!file1.exists() || !file2.exists()) {
return false;
@@ -69,13 +69,14 @@ public class TranslateTest {
byte[] buffer1 = new byte[BUF_SIZE];
byte[] buffer2 = new byte[BUF_SIZE];
+ @SuppressWarnings("resource")
FileInputStream fis1 = new FileInputStream(file1);
+ @SuppressWarnings("resource")
FileInputStream fis2 = new FileInputStream(file2);
- int index = 0;
int read = 0;
while ((read = fis1.read(buffer1)) != -1) {
fis2.read(buffer2);
- for (int i = 0; i < read; ++i, ++index) {
+ for (int i = 0; i < read; ++i) {
if (buffer1[i] != buffer2[i]) {
return false;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
index eeece1c..85747ab 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
@@ -66,8 +66,7 @@ public class ImageTest {
AntAssert.assertContains("Processing File", buildRule.getLog());
File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
- assertTrue(
- "Did not create "+f.getAbsolutePath(),
+ assertTrue("Did not create " + f.getAbsolutePath(),
f.exists());
}
@@ -107,8 +106,7 @@ public class ImageTest {
buildRule.executeTarget("testSimpleScaleWithMapper");
AntAssert.assertContains("Processing File", buildRule.getLog());
File f = new File(buildRule.getOutputDir(), "scaled-" + LARGEIMAGE);
- assertTrue(
- "Did not create "+f.getAbsolutePath(),
+ assertTrue("Did not create " + f.getAbsolutePath(),
f.exists());
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
index 545b7cb..df4dccd 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
@@ -83,7 +83,7 @@ public class JDependTest {
@Test
public void testTimeout() {
buildRule.executeTarget("fork-xml");
- AntAssert.assertContains( "JDepend FAILED - Timed out", buildRule.getLog());
+ AntAssert.assertContains("JDepend FAILED - Timed out", buildRule.getLog());
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
index aa483f6..a5ad2fe 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/BatchTestTest.java
@@ -18,9 +18,8 @@
package org.apache.tools.ant.taskdefs.optional.junit;
-
-import static org.junit.Assert.fail;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.fail;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
index c322401..7f996df 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/DOMUtilTest.java
@@ -44,10 +44,7 @@ public class DOMUtilTest {
public class FooNodeFilter implements DOMUtil.NodeFilter {
public boolean accept(Node node) {
- if (node.getNodeName().equals("foo")) {
- return true;
- }
- return false;
+ return node.getNodeName().equals("foo");
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
index 4baf741..175df5f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitClassLoaderTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class JUnitClassLoaderTest {
@Test
- public void testContextClassLoader(){
+ public void testContextClassLoader() {
ClassLoader context = Thread.currentThread().getContextClassLoader();
ClassLoader caller = getClass().getClassLoader();
assertSame(context, caller);
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
index a7ebbc6..e99c462 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
@@ -26,10 +26,11 @@ import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileReader;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.security.Permission;
+
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
@@ -63,8 +64,8 @@ public class JUnitReportTest {
@Test
public void testNoFileJUnitNoFrames() {
buildRule.executeTarget("reports1");
- assertFalse("No file junit-noframes.html expected", (new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html").exists()));
-
+ assertFalse("No file junit-noframes.html expected", new File(System.getProperty("root"),
+ "src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html").exists());
}
public void assertIndexCreated() {
@@ -83,11 +84,11 @@ public class JUnitReportTest {
private void commonIndexFileAssertions(File reportFile) throws IOException {
// tests one the file object
- assertTrue("No index.html present. Not generated?", reportFile.exists() );
- assertTrue("Cant read the report file.", reportFile.canRead() );
- assertTrue("File shouldn't be empty.", reportFile.length() > 0 );
+ assertTrue("No index.html present. Not generated?", reportFile.exists());
+ assertTrue("Can't read the report file.", reportFile.canRead());
+ assertTrue("File shouldn't be empty.", reportFile.length() > 0);
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
- URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
+ URL reportUrl = new URL(FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()));
InputStream reportStream = reportUrl.openStream();
try {
assertTrue("This shouldn't be an empty stream.", reportStream.available() > 0);
@@ -194,7 +195,10 @@ public class JUnitReportTest {
throw new RuntimeException(exc);
}
try {
- System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+ System.setSecurityManager(new SecurityManager() {
+ public void checkPermission(Permission perm) {
+ }
+ });
buildRule.executeTarget("testWithStyleFromClasspath");
commonIndexFileAssertions();
} finally {
@@ -215,7 +219,10 @@ public class JUnitReportTest {
return super.getResourceAsStream(name);
}
});
- System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+ System.setSecurityManager(new SecurityManager() {
+ public void checkPermission(Permission perm) {
+ }
+ });
buildRule.executeTarget("testWithStyleFromClasspath");
commonIndexFileAssertions();
} finally {
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
index c393005..07baeee 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
@@ -35,7 +35,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
@@ -44,13 +43,12 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
-import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.launcher.CommandLauncher;
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkMode;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.util.LoaderUtils;
@@ -141,7 +139,7 @@ public class JUnitTaskTest {
public void testFailureRecorder() {
if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_1_5)) {
try {
- Class<?> clazz =Class.forName("junit.framework.JUnit4TestAdapter");
+ Class<?> clazz = Class.forName("junit.framework.JUnit4TestAdapter");
Assume.assumeFalse("Skipping test since it fails with JUnit 4", clazz != null);
} catch (ClassNotFoundException e) {
// OK, this is JUnit3, can run test
@@ -364,16 +362,25 @@ public class JUnitTaskTest {
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
- assertEquals("Incorrect number of skipped tests in header", 4, Integer.parseInt(xpath.compile("//testsuite/@skipped").evaluate(doc)));
- assertEquals("Incorrect number of error tests in header", 1, Integer.parseInt(xpath.compile("//testsuite/@errors").evaluate(doc)));
- assertEquals("Incorrect number of failure tests in header", 2, Integer.parseInt(xpath.compile("//testsuite/@failures").evaluate(doc)));
- assertEquals("Incorrect number of tests in header", 8, Integer.parseInt(xpath.compile("//testsuite/@tests").evaluate(doc)));
-
-
- assertEquals("Incorrect ignore message on explicit ignored test", "Please don't ignore me!", xpath.compile("//testsuite/testcase[@name='explicitIgnoreTest']/skipped/@message").evaluate(doc));
- assertEquals("No message should be set on Ignored tests with no Ignore annotation text", 0, ((Node)xpath.compile("//testsuite/testcase[@name='explicitlyIgnoreTestNoMessage']/skipped").evaluate(doc, XPathConstants.NODE)).getAttributes().getLength());
- assertEquals("Incorrect ignore message on implicit ignored test", "This test will be ignored", xpath.compile("//testsuite/testcase[@name='implicitlyIgnoreTest']/skipped/@message").evaluate(doc));
- assertNotNull("Implicit ignore test should have an ignore element", xpath.compile("//testsuite/testcase[@name='implicitlyIgnoreTestNoMessage']/skipped").evaluate(doc, XPathConstants.NODE));
+ assertEquals("Incorrect number of skipped tests in header", 4,
+ Integer.parseInt(xpath.compile("//testsuite/@skipped").evaluate(doc)));
+ assertEquals("Incorrect number of error tests in header", 1,
+ Integer.parseInt(xpath.compile("//testsuite/@errors").evaluate(doc)));
+ assertEquals("Incorrect number of failure tests in header", 2,
+ Integer.parseInt(xpath.compile("//testsuite/@failures").evaluate(doc)));
+ assertEquals("Incorrect number of tests in header", 8,
+ Integer.parseInt(xpath.compile("//testsuite/@tests").evaluate(doc)));
+
+
+ assertEquals("Incorrect ignore message on explicit ignored test", "Please don't ignore me!",
+ xpath.compile("//testsuite/testcase[@name='explicitIgnoreTest']/skipped/@message").evaluate(doc));
+ assertEquals("No message should be set on Ignored tests with no Ignore annotation text", 0,
+ ((Node)xpath.compile("//testsuite/testcase[@name='explicitlyIgnoreTestNoMessage']/skipped")
+ .evaluate(doc, XPathConstants.NODE)).getAttributes().getLength());
+ assertEquals("Incorrect ignore message on implicit ignored test", "This test will be ignored",
+ xpath.compile("//testsuite/testcase[@name='implicitlyIgnoreTest']/skipped/@message").evaluate(doc));
+ assertNotNull("Implicit ignore test should have an ignore element",
+ xpath.compile("//testsuite/testcase[@name='implicitlyIgnoreTestNoMessage']/skipped").evaluate(doc, XPathConstants.NODE));
}
@@ -386,26 +393,44 @@ public class JUnitTaskTest {
public void testNonTestsSkipped() throws Exception {
buildRule.executeTarget("testNonTests");
- assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.NonTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.NonTestMissed.xml").exists());
- assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3TestMissed.xml").exists());
- assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.AbstractTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestMissed.xml").exists());
- assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.AbstractJUnit3TestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractJUnit3TestMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractJUnit3TestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractJUnit3TestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3TestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3TestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestWithSuiteNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestWithSuiteNotMissed.xml").exists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.NonTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.NonTestMissed.xml").exists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3TestMissed.xml").exists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.AbstractTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestMissed.xml").exists());
+ assertFalse("Test result should not exist as test was skipped - TEST-org.example.junit.AbstractJUnit3TestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractJUnit3TestMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractJUnit3TestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractJUnit3TestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3TestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3TestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestWithSuiteNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestWithSuiteNotMissed.xml").exists());
buildRule.executeTarget("testNonTestsRun");
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.NonTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.NonTestMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3NonTestMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3TestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3TestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestNotMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractJUnit3TestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractJUnit3TestMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3NonTestMissed.xml").exists());
- assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestWithSuiteNotMissed.xml", new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestWithSuiteNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.NonTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.NonTestMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3NonTestMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3TestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3TestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractTestNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractTestNotMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.AbstractJUnit3TestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.AbstractJUnit3TestMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.JUnit3NonTestMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.JUnit3NonTestMissed.xml").exists());
+ assertTrue("Test result should exist as test was not skipped - TEST-org.example.junit.TestWithSuiteNotMissed.xml",
+ new File(buildRule.getOutputDir(), "TEST-org.example.junit.TestWithSuiteNotMissed.xml").exists());
}
@@ -441,7 +466,7 @@ public class JUnitTaskTest {
final File tmp = new File(System.getProperty("java.io.tmpdir")); //NOI18N
final File workDir = new File(tmp, String.format("%s_testJCP%d", //NOI18N
getClass().getName(),
- System.currentTimeMillis()/1000));
+ System.currentTimeMillis() / 1000));
workDir.mkdirs();
try {
final File modulesDir = new File(workDir,"modules"); //NOI18N
@@ -473,7 +498,7 @@ public class JUnitTaskTest {
String resCp = null;
String resMp = null;
Set<String> resExports = new TreeSet<>();
- for (int i = 1; i< mockProcLauncher.cmd.length; i++) {
+ for (int i = 1; i < mockProcLauncher.cmd.length; i++) {
if ("-classpath".equals(mockProcLauncher.cmd[i])) { //NOI18N
resCp = mockProcLauncher.cmd[++i];
} else if ("--module-path".equals(mockProcLauncher.cmd[i])) { //NOI18N
@@ -500,10 +525,10 @@ public class JUnitTaskTest {
final File tmp = new File(System.getProperty("java.io.tmpdir")); //NOI18N
final File workDir = new File(tmp, String.format("%s_testJMP%d", //NOI18N
getClass().getName(),
- System.currentTimeMillis()/1000));
+ System.currentTimeMillis() / 1000));
workDir.mkdirs();
try {
- final File modulesDir = new File(workDir,"modules"); //NOI18N
+ final File modulesDir = new File(workDir, "modules"); //NOI18N
modulesDir.mkdirs();
final Project project = new Project();
@@ -530,7 +555,7 @@ public class JUnitTaskTest {
String resCp = null;
String resMp = null;
Set<String> resExports = new TreeSet<>();
- for (int i = 1; i< mockProcLauncher.cmd.length; i++) {
+ for (int i = 1; i < mockProcLauncher.cmd.length; i++) {
if ("-classpath".equals(mockProcLauncher.cmd[i])) { //NOI18N
resCp = mockProcLauncher.cmd[++i];
} else if ("--module-path".equals(mockProcLauncher.cmd[i])) { //NOI18N
http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
index 49c1fb4..0067203 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestListenerTest.java
@@ -26,7 +26,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-public class JUnitTestListenerTest{
+public class JUnitTestListenerTest {
@Rule
public BuildFileRule buildRule = new BuildFileRule();