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:49:32 UTC
[5/6] ant git commit: Checkstyle: mostly whitespace (cf master)
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java b/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
index bd88143..b85af3f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/BZip2Test.java
@@ -101,12 +101,12 @@ public class BZip2Test {
}
@Test
- public void testResource(){
+ public void testResource() {
buildRule.executeTarget("realTestWithResource");
}
@Test
- public void testDateCheck(){
+ public void testDateCheck() {
buildRule.executeTarget("testDateCheck");
String log = buildRule.getLog();
assertTrue(
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
index 9fe42b1..63ee645 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
@@ -18,7 +18,7 @@
package org.apache.tools.ant.taskdefs;
-import java.io.*;
+import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
@@ -44,7 +44,7 @@ public class CVSPassTest {
":pserver:anoncvs@xml.apache.org:/home/cvspublic Ay=0=h<Z";
private static final String TIGRIS_URL =
":pserver:guest@cvs.tigris.org:/cvs AIbdZ,";
-
+
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
@@ -56,20 +56,20 @@ public class CVSPassTest {
@Test
public void testNoCVSRoot() {
- try{
+ try {
buildRule.executeTarget("test1");
fail("BuildException not thrown");
- }catch(BuildException e){
+ } catch (BuildException e) {
assertEquals("cvsroot is required", e.getMessage());
}
}
@Test
public void testNoPassword() {
- try{
+ try {
buildRule.executeTarget("test2");
fail("BuildException not thrown");
- }catch(BuildException e){
+ } catch (BuildException e) {
assertEquals("password is required", e.getMessage());
}
}
@@ -84,10 +84,9 @@ public class CVSPassTest {
buildRule.executeTarget("test3");
File f = new File(buildRule.getProject().getBaseDir(), "testpassfile.tmp");
- assertTrue( "Passfile "+f+" not created", f.exists());
-
- assertEquals(JAKARTA_URL+EOL, FileUtilities.getFileContents(f));
+ assertTrue("Passfile " + f + " not created", f.exists());
+ assertEquals(JAKARTA_URL + EOL, FileUtilities.getFileContents(f));
}
@Test
@@ -95,11 +94,9 @@ public class CVSPassTest {
buildRule.executeTarget("test4");
File f = new File(buildRule.getProject().getBaseDir(), "testpassfile.tmp");
- assertTrue( "Passfile "+f+" not created", f.exists());
+ assertTrue("Passfile " + f + " not created", f.exists());
- assertEquals(
- JAKARTA_URL+ EOL+
- TIGRIS_URL+ EOL,
+ assertEquals(JAKARTA_URL + EOL+ TIGRIS_URL + EOL,
FileUtilities.getFileContents(f));
}
@@ -108,12 +105,9 @@ public class CVSPassTest {
buildRule.executeTarget("test5");
File f = new File(buildRule.getProject().getBaseDir(), "testpassfile.tmp");
- assertTrue( "Passfile "+f+" not created", f.exists());
+ assertTrue("Passfile " + f + " not created", f.exists());
- assertEquals(
- JAKARTA_URL+ EOL+
- XML_URL+ EOL+
- TIGRIS_URL+ EOL,
+ assertEquals(JAKARTA_URL + EOL + XML_URL + EOL+ TIGRIS_URL + EOL,
FileUtilities.getFileContents(f));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java
index bd4bdfc..8d26153 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java
@@ -18,19 +18,19 @@
package org.apache.tools.ant.taskdefs;
+import java.io.IOException;
+
import org.apache.tools.ant.BuildFileRule;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import java.io.IOException;
-
public class ChecksumTest {
@Rule
public BuildFileRule buildRule = new BuildFileRule();
-
+
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/taskdefs/checksum.xml");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
index b544183..b421650 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
@@ -96,7 +96,7 @@ public class ConcatTest {
try {
buildRule.executeTarget("test2");
fail("BuildException should have been thrown - Invalid destination file");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
//TODO assert value
}
}
@@ -192,7 +192,7 @@ public class ConcatTest {
File file2 = new File(buildRule.getProject().getBaseDir(), tempFile2);
final long newSize = file2.length();
- assertEquals(origSize*2, newSize);
+ assertEquals(origSize * 2, newSize);
}
@@ -267,9 +267,7 @@ public class ConcatTest {
* Check if fixlastline works
*/
@Test
- public void testfixlastline()
- throws IOException
- {
+ public void testfixlastline() throws IOException {
buildRule.executeTarget("testfixlastline");
assertContains("end of line" + System.getProperty("line.separator") + "This has",
FileUtilities.getFileContents(buildRule.getProject(), "concat.line4"));
@@ -279,14 +277,11 @@ public class ConcatTest {
* Check if fixlastline works with eol
*/
@Test
- public void testfixlastlineeol()
- throws IOException
- {
+ public void testfixlastlineeol() throws IOException {
buildRule.executeTarget("testfixlastlineeol");
assertContains("end of line\rThis has", FileUtilities.getFileContents(buildRule.getProject(), "concat.linecr"));
}
-
@Test
public void testTranscoding() throws IOException {
buildRule.executeTarget("testTranscoding");
@@ -299,10 +294,9 @@ public class ConcatTest {
// ------------------------------------------------------
// Helper methods - should be in a utility class
// -----------------------------------------------------
- private void expectFileContainsx(
- String target, String filename, String contains)
- throws IOException
- {
+ @SuppressWarnings("unused")
+ private void expectFileContainsx(String target, String filename, String contains)
+ throws IOException {
buildRule.executeTarget(target);
String content = FileUtilities.getFileContents(buildRule.getProject(), filename);
assertTrue(
@@ -311,5 +305,4 @@ public class ConcatTest {
" but got " + content, content.indexOf(contains) > -1);
}
-
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ConditionTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ConditionTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ConditionTest.java
index 1b6c103..9329512 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ConditionTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ConditionTest.java
@@ -72,7 +72,7 @@ public class ConditionTest {
try {
buildRule.executeTarget("condition-empty");
fail("BuildException should have been thrown - no conditions");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("You must nest a condition into <condition>", ex.getMessage());
}
}
@@ -255,7 +255,7 @@ public class ConditionTest {
try {
buildRule.executeTarget("contains-incomplete1");
fail("BuildException should have been thrown - Missing contains attribute");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("both string and substring are required in contains", ex.getMessage());
}
}
@@ -265,7 +265,7 @@ public class ConditionTest {
try {
buildRule.executeTarget("contains-incomplete2");
fail("BuildException should have been thrown - Missing contains attribute");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("both string and substring are required in contains", ex.getMessage());
}
}
@@ -293,7 +293,7 @@ public class ConditionTest {
try {
buildRule.executeTarget("istrue-incomplete");
fail("BuildException should have been thrown - Missing attribute");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("Nothing to test for truth", ex.getMessage());
}
}
@@ -322,7 +322,7 @@ public class ConditionTest {
try {
buildRule.executeTarget("isfalse-incomplete");
fail("BuildException should have been thrown - Missing attribute");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("Nothing to test for falsehood", ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
index 719bc44..fc03f28 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
@@ -60,7 +60,7 @@ public class CopyTest {
public void test1() {
buildRule.executeTarget("test1");
File f = new File(buildRule.getProject().getProperty("output"), "copytest1.tmp");
- if ( !f.exists()) {
+ if (!f.exists()) {
fail("Copy failed");
}
}
@@ -69,7 +69,7 @@ public class CopyTest {
public void test2() {
buildRule.executeTarget("test2");
File f = new File(buildRule.getProject().getProperty("output"), "copytest1dir/copy.xml");
- if ( !f.exists()) {
+ if (!f.exists()) {
fail("Copy failed");
}
}
@@ -79,7 +79,7 @@ public class CopyTest {
buildRule.executeTarget("test3");
File file3 = new File(buildRule.getProject().getProperty("output"), "copytest3.tmp");
//rollback file timestamp instead of delaying test
- FileUtilities.rollbackTimetamps(file3, 3);
+ FileUtilities.rollbackTimestamps(file3, 3);
buildRule.executeTarget("test3Part2");
assertTrue(file3.exists());
@@ -91,19 +91,19 @@ public class CopyTest {
assertTrue(file3c.exists());
//file length checks rely on touch generating a zero byte file
- if(file3.length()==0) {
+ if (file3.length()==0) {
fail("could not overwrite an existing, older file");
}
- if(file3c.length()!=0) {
+ if (file3c.length()!=0) {
fail("could not force overwrite an existing, newer file");
}
- if(file3b.length()==0) {
+ if (file3b.length()==0) {
fail("unexpectedly overwrote an existing, newer file");
}
//file time checks for java1.2+
- assertTrue(file3a.lastModified()==file3.lastModified());
- assertTrue(file3c.lastModified()<file3a.lastModified());
+ assertTrue(file3a.lastModified() == file3.lastModified());
+ assertTrue(file3c.lastModified() < file3a.lastModified());
}
@@ -197,9 +197,9 @@ public class CopyTest {
@Test
public void testFileResourcePlain() {
buildRule.executeTarget("testFileResourcePlain");
- File file1 = new File(buildRule.getProject().getProperty("to.dir")+"/file1.txt");
- File file2 = new File(buildRule.getProject().getProperty("to.dir")+"/file2.txt");
- File file3 = new File(buildRule.getProject().getProperty("to.dir")+"/file3.txt");
+ File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt");
+ File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt");
+ File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt");
assertTrue(file1.exists());
assertTrue(file2.exists());
assertTrue(file3.exists());
@@ -209,9 +209,9 @@ public class CopyTest {
@Test
public void testFileResourceWithMapper() {
buildRule.executeTarget("testFileResourceWithMapper");
- File file1 = new File(buildRule.getProject().getProperty("to.dir")+"/file1.txt.bak");
- File file2 = new File(buildRule.getProject().getProperty("to.dir")+"/file2.txt.bak");
- File file3 = new File(buildRule.getProject().getProperty("to.dir")+"/file3.txt.bak");
+ File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt.bak");
+ File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt.bak");
+ File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt.bak");
assertTrue(file1.exists());
assertTrue(file2.exists());
assertTrue(file3.exists());
@@ -220,7 +220,7 @@ public class CopyTest {
@Test
public void testFileResourceWithFilter() {
buildRule.executeTarget("testFileResourceWithFilter");
- File file1 = new File(buildRule.getProject().getProperty("to.dir")+"/fileNR.txt");
+ File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/fileNR.txt");
assertTrue(file1.exists());
try {
String file1Content = FileUtils.readFully(new FileReader(file1));
@@ -233,9 +233,9 @@ public class CopyTest {
@Test
public void testPathAsResource() {
buildRule.executeTarget("testPathAsResource");
- File file1 = new File(buildRule.getProject().getProperty("to.dir")+"/file1.txt");
- File file2 = new File(buildRule.getProject().getProperty("to.dir")+"/file2.txt");
- File file3 = new File(buildRule.getProject().getProperty("to.dir")+"/file3.txt");
+ File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt");
+ File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt");
+ File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt");
assertTrue(file1.exists());
assertTrue(file2.exists());
assertTrue(file3.exists());
@@ -244,9 +244,9 @@ public class CopyTest {
@Test
public void testZipfileset() {
buildRule.executeTarget("testZipfileset");
- File file1 = new File(buildRule.getProject().getProperty("to.dir")+"/file1.txt");
- File file2 = new File(buildRule.getProject().getProperty("to.dir")+"/file2.txt");
- File file3 = new File(buildRule.getProject().getProperty("to.dir")+"/file3.txt");
+ File file1 = new File(buildRule.getProject().getProperty("to.dir") + "/file1.txt");
+ File file2 = new File(buildRule.getProject().getProperty("to.dir") + "/file2.txt");
+ File file3 = new File(buildRule.getProject().getProperty("to.dir") + "/file3.txt");
assertTrue(file1.exists());
assertTrue(file2.exists());
assertTrue(file3.exists());
@@ -285,7 +285,7 @@ public class CopyTest {
* Tests that the {@code copy} task doesn't corrupt the source file, if the target of the copy operation is a symlink
* to the source file being copied
*
- * @throws Exception
+ * @throws Exception if something goes wrong
* @see <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=60644">issue 60644</a>
*/
@Test
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java
index a7fdd5c..adad994 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CopydirTest.java
@@ -79,7 +79,7 @@ public class CopydirTest {
@Test
public void test5() {
buildRule.executeTarget("test5");
- java.io.File f = new java.io.File(new File(buildRule.getProject().getProperty("output")), "taskdefs.tmp");
+ File f = new File(new File(buildRule.getProject().getProperty("output")), "taskdefs.tmp");
if (!f.exists() || !f.isDirectory()) {
fail("Copy failed");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
index e093d4f..06ca3a2 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
@@ -157,13 +157,13 @@ public class DefaultExcludesTest {
private void assertArrayContentsEquals(String message, String[] expected, String[] actual) {
// check that both arrays have the same size
assertEquals(message + " : string array length match", expected.length, actual.length);
- for (int counter=0; counter < expected.length; counter++) {
+ for (String element : expected) {
boolean found = false;
for (int i = 0; !found && i < actual.length; i++) {
- found |= expected[counter].equals(actual[i]);
+ found |= element.equals(actual[i]);
}
assertTrue(message + " : didn't find element "
- + expected[counter] + " in array match", found);
+ + element + " in array match", found);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
index 8db1c5f..d870348 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
@@ -46,7 +46,7 @@ public class DirnameTest {
try {
buildRule.executeTarget("test1");
fail("Build exception should have been thrown as property attribute is required");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("property attribute required", ex.getMessage());
}
}
@@ -56,7 +56,7 @@ public class DirnameTest {
try {
buildRule.executeTarget("test2");
fail("Build exception should have been thrown as file attribute is required");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("file attribute required", ex.getMessage());
}
}
@@ -66,7 +66,7 @@ public class DirnameTest {
try {
buildRule.executeTarget("test3");
fail("Build exception should have been thrown as property attribute is required");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals("property attribute required", ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
index 5c2ae28..6f0c7a9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
@@ -50,7 +50,7 @@ public class EchoTest {
echo.setProject(p);
echo.setTaskName("testLogBlankEcho");
echo.execute();
- assertEquals("[testLogBlankEcho] ", logger.lastLoggedMessage );
+ assertEquals("[testLogBlankEcho] ", logger.lastLoggedMessage);
}
@Test
@@ -67,15 +67,14 @@ public class EchoTest {
echo.setFile(removeThis);
echo.setEncoding("UTF-8");
echo.execute();
- String x = FileUtils.readFully(new InputStreamReader(new FileInputStream(removeThis), "UTF-8" ));
+ String x = FileUtils.readFully(new InputStreamReader(new FileInputStream(removeThis), "UTF-8"));
assertEquals(x,"\u00e4\u00a9");
}
@After
public void tearDown() {
if (removeThis != null && removeThis.exists()) {
- if (!removeThis.delete())
- {
+ if (!removeThis.delete()) {
removeThis.deleteOnExit();
}
}
@@ -83,7 +82,7 @@ public class EchoTest {
private class EchoTestLogger extends DefaultLogger {
String lastLoggedMessage;
-
+
/**
* Create a new EchoTestLogger.
*/
@@ -100,6 +99,6 @@ public class EchoTest {
protected void log(String message) {
this.lastLoggedMessage = message;
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java
index 069645b..9e87af0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteJavaTest.java
@@ -37,15 +37,15 @@ public class ExecuteJavaTest {
private final static int TIME_OUT = 5000;
- private final static int CLOCK_ERROR=200;
- private final static int TIME_OUT_TEST=TIME_OUT-CLOCK_ERROR;
+ private final static int CLOCK_ERROR = 200;
+ private final static int TIME_OUT_TEST = TIME_OUT - CLOCK_ERROR;
private ExecuteJava ej;
private Project project;
private Path cp;
@Before
- public void setUp(){
+ public void setUp() {
ej = new ExecuteJava();
ej.setTimeout((long)TIME_OUT);
project = new Project();
@@ -64,7 +64,7 @@ public class ExecuteJavaTest {
@Test
public void testNoTimeOut() throws Exception {
- Commandline cmd = getCommandline(TIME_OUT/2);
+ Commandline cmd = getCommandline(TIME_OUT / 2);
ej.setJavaCommand(cmd);
ej.execute(project);
assertTrue("process should not have been killed", !ej.killedProcess());
@@ -73,24 +73,24 @@ public class ExecuteJavaTest {
// test that the watchdog ends the process
@Test
public void testTimeOut() throws Exception {
- Commandline cmd = getCommandline(TIME_OUT*2);
+ Commandline cmd = getCommandline(TIME_OUT * 2);
ej.setJavaCommand(cmd);
long now = System.currentTimeMillis();
ej.execute(project);
long elapsed = System.currentTimeMillis() - now;
assertTrue("process should have been killed", ej.killedProcess());
- assertTrue("elapse time of "+elapsed
- +" ms is less than timeout value of "+TIME_OUT_TEST+" ms",
+ assertTrue("elapse time of " + elapsed
+ + " ms is less than timeout value of " + TIME_OUT_TEST + " ms",
elapsed >= TIME_OUT_TEST);
- assertTrue("elapse time of "+elapsed
- +" ms is greater than run value of "+(TIME_OUT*2)+" ms",
- elapsed < TIME_OUT*2);
+ assertTrue("elapse time of " + elapsed
+ + " ms is greater than run value of " + (TIME_OUT * 2) + " ms",
+ elapsed < TIME_OUT * 2);
}
@Test
public void testNoTimeOutForked() throws Exception {
- Commandline cmd = getCommandline(TIME_OUT/2);
+ Commandline cmd = getCommandline(TIME_OUT / 2);
ej.setJavaCommand(cmd);
ej.fork(cp);
assertTrue("process should not have been killed", !ej.killedProcess());
@@ -99,26 +99,26 @@ public class ExecuteJavaTest {
// test that the watchdog ends the process
@Test
public void testTimeOutForked() throws Exception {
- Commandline cmd = getCommandline(TIME_OUT*2);
+ Commandline cmd = getCommandline(TIME_OUT * 2);
ej.setJavaCommand(cmd);
long now = System.currentTimeMillis();
ej.fork(cp);
long elapsed = System.currentTimeMillis() - now;
assertTrue("process should have been killed", ej.killedProcess());
- assertTrue("elapse time of "+elapsed
- +" ms is less than timeout value of "+TIME_OUT_TEST+" ms",
+ assertTrue("elapse time of " + elapsed
+ + " ms is less than timeout value of " + TIME_OUT_TEST + " ms",
elapsed >= TIME_OUT_TEST);
- assertTrue("elapse time of "+elapsed
- +" ms is greater than run value of "+(TIME_OUT*2)+" ms",
- elapsed < TIME_OUT*2);
+ assertTrue("elapse time of " + elapsed
+ + " ms is greater than run value of " + (TIME_OUT * 2) + " ms",
+ elapsed < TIME_OUT * 2);
}
/**
* Dangerous method to obtain the classpath for the test. This is
* severely tighted to the build.xml properties.
*/
- private static String getTestClassPath(){
+ private static String getTestClassPath() {
String classpath = System.getProperty("build.tests");
if (classpath == null) {
System.err.println("WARNING: 'build.tests' property is not available !");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
index 1834d5e..f23ea3b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
@@ -40,13 +40,13 @@ public class ExecuteWatchdogTest {
private final static String TEST_CLASSPATH = getTestClassPath();
- private final static int CLOCK_ERROR=200;
- private final static long TIME_OUT_TEST=TIME_OUT-CLOCK_ERROR;
+ private final static int CLOCK_ERROR = 200;
+ private final static long TIME_OUT_TEST = TIME_OUT - CLOCK_ERROR;
private ExecuteWatchdog watchdog;
@Before
- public void setUp(){
+ public void setUp() {
watchdog = new ExecuteWatchdog(TIME_OUT);
}
@@ -54,7 +54,7 @@ public class ExecuteWatchdogTest {
* Dangerous method to obtain the classpath for the test. This is
* severely tied to the build.xml properties.
*/
- private static String getTestClassPath(){
+ private static String getTestClassPath() {
String classpath = System.getProperty("build.tests");
if (classpath == null) {
System.err.println("WARNING: 'build.tests' property is not available !");
@@ -74,10 +74,10 @@ public class ExecuteWatchdogTest {
}
private String getErrorOutput(Process p) throws Exception {
- BufferedReader err = new BufferedReader( new InputStreamReader(p.getErrorStream()) );
- StringBuffer buf = new StringBuffer();
+ BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ StringBuilder buf = new StringBuilder();
String line;
- while ( (line = err.readLine()) != null){
+ while ((line = err.readLine()) != null) {
buf.append(line);
}
return buf.toString();
@@ -85,9 +85,9 @@ public class ExecuteWatchdogTest {
private int waitForEnd(Process p) throws Exception {
int retcode = p.waitFor();
- if (retcode != 0){
+ if (retcode != 0) {
String err = getErrorOutput(p);
- if (err.length() > 0){
+ if (err.length() > 0) {
System.err.println("ERROR:");
System.err.println(err);
}
@@ -97,25 +97,28 @@ public class ExecuteWatchdogTest {
@Test
public void testNoTimeOut() throws Exception {
- Process process = getProcess(TIME_OUT/2);
+ Process process = getProcess(TIME_OUT / 2);
watchdog.start(process);
int retCode = waitForEnd(process);
- assertTrue("process should not have been killed", !watchdog.killedProcess());
+ assertFalse("process should not have been killed", watchdog.killedProcess());
assertFalse(Execute.isFailure(retCode));
}
// test that the watchdog ends the process
@Test
public void testTimeOut() throws Exception {
- Process process = getProcess(TIME_OUT*2);
+ Process process = getProcess(TIME_OUT * 2);
long now = System.currentTimeMillis();
watchdog.start(process);
- int retCode = process.waitFor();
+ @SuppressWarnings("unused")
+ int retCode = process.waitFor();
long elapsed = System.currentTimeMillis() - now;
assertTrue("process should have been killed", watchdog.killedProcess());
- // assertTrue("return code is invalid: " + retCode, retCode!=0);
- assertTrue("elapse time of "+elapsed+" ms is less than timeout value of "+TIME_OUT_TEST+" ms", elapsed >= TIME_OUT_TEST);
- assertTrue("elapse time of "+elapsed+" ms is greater than run value of "+(TIME_OUT*2)+" ms", elapsed < TIME_OUT*2);
+ // assertNotEquals("return code is invalid: " + retCode, retCode, 0);
+ assertTrue("elapse time of " + elapsed + " ms is less than timeout value of " + TIME_OUT_TEST + " ms",
+ elapsed >= TIME_OUT_TEST);
+ assertTrue("elapse time of " + elapsed + " ms is greater than run value of " + (TIME_OUT * 2) + " ms",
+ elapsed < TIME_OUT * 2);
}
// test a process that runs and failed
@@ -130,7 +133,7 @@ public class ExecuteWatchdogTest {
@Test
public void testManualStop() throws Exception {
- final Process process = getProcess(TIME_OUT*2);
+ final Process process = getProcess(TIME_OUT * 2);
watchdog.start(process);
// I assume that starting this takes less than TIME_OUT/2 ms...
@@ -146,8 +149,8 @@ public class ExecuteWatchdogTest {
};
thread.start();
- // wait for TIME_OUT/2, there should be about TIME_OUT/2 ms remaining before timeout
- thread.join(TIME_OUT/2);
+ // wait for TIME_OUT / 2, there should be about TIME_OUT / 2 ms remaining before timeout
+ thread.join(TIME_OUT / 2);
// now stop the watchdog.
watchdog.stop();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/FailTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/FailTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/FailTest.java
index 8883558..5bcc169 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/FailTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/FailTest.java
@@ -43,7 +43,7 @@ public class FailTest {
public void test1() {
try {
buildRule.executeTarget("test1");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("No message", ex.getMessage());
}
@@ -53,7 +53,7 @@ public class FailTest {
public void test2() {
try {
buildRule.executeTarget("test2");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("test2", ex.getMessage());
}
@@ -63,7 +63,7 @@ public class FailTest {
public void testText() {
try {
buildRule.executeTarget("testText");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("testText", ex.getMessage());
}
@@ -75,7 +75,7 @@ public class FailTest {
buildRule.getProject().setProperty("foo", "");
try {
buildRule.executeTarget("testIf");
- fail("testIf must fail if foo has been set") ;
+ fail("testIf must fail if foo has been set");
} catch (BuildException ex) {
//TODO assert result
}
@@ -85,7 +85,7 @@ public class FailTest {
public void testUnless() {
try {
buildRule.executeTarget("testUnless");
- fail("testUnless must fail unless foo has been set") ;
+ fail("testUnless must fail unless foo has been set");
} catch (BuildException ex) {
//TODO assert rules
}
@@ -106,7 +106,7 @@ public class FailTest {
buildRule.getProject().setProperty("if", "");
try {
buildRule.executeTarget("testIfAndUnless");
- fail("expect fail on defined(if)") ;
+ fail("expect fail on defined(if)");
} catch (BuildException ex) {
assertEquals("if=if and unless=unless", ex.getMessage());
}
@@ -129,7 +129,7 @@ public class FailTest {
public void testNested1() {
try {
buildRule.executeTarget("testNested1");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("condition satisfied", ex.getMessage());
}
@@ -144,7 +144,7 @@ public class FailTest {
public void testNested3() {
try {
buildRule.executeTarget("testNested3");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("testNested3", ex.getMessage());
}
@@ -156,13 +156,13 @@ public class FailTest {
+ "not permitted in conjunction with if/unless attributes";
char[] c = {'a', 'b', 'c'};
- StringBuffer target = new StringBuffer("testNested4x");
+ StringBuilder target = new StringBuilder("testNested4x");
for (int i = 0; i < c.length; i++) {
target.setCharAt(target.length() - 1, c[i]);
try {
buildRule.executeTarget(target.toString());
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals(specificMessage, ex.getMessage());
}
@@ -173,7 +173,7 @@ public class FailTest {
public void testNested5() {
try {
buildRule.executeTarget("testNested5");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("Only one nested condition is allowed.", ex.getMessage());
}
@@ -183,7 +183,7 @@ public class FailTest {
public void testNested6() {
try {
buildRule.executeTarget("testNested6");
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals("testNested6\ntestNested6\ntestNested6", ex.getMessage());
}
@@ -194,13 +194,13 @@ public class FailTest {
String specificMessage = "A single nested condition is required.";
char[] c = {'a', 'b'};
- StringBuffer target = new StringBuffer("testNested7x");
+ StringBuilder target = new StringBuilder("testNested7x");
for (int i = 0; i < c.length; i++) {
target.setCharAt(target.length() - 1, c[i]);
try {
buildRule.executeTarget(target.toString());
- fail("it is required to fail :-)") ;
+ fail("it is required to fail :-)");
} catch (BuildException ex) {
assertEquals(specificMessage, ex.getMessage());
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/FilterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/FilterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/FilterTest.java
index fdbec6e..0e40ad8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/FilterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/FilterTest.java
@@ -126,19 +126,19 @@ public class FilterTest {
String line = null;
File f = new File(buildRule.getProject().getBaseDir(), filteredFile);
if (!f.exists()) {
- fail("filter test"+testNumber+" failed");
+ fail("filter test" + testNumber + " failed");
} else {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException fnfe) {
- fail("filter test"+testNumber+" failed, filtered file: " + f.toString() + " not found");
+ fail("filter test" + testNumber + " failed, filtered file: " + f.toString() + " not found");
}
try {
line = in.readLine();
in.close();
} catch (IOException ioe) {
- fail("filter test"+testNumber+" failed. IOException while reading filtered file: " + ioe);
+ fail("filter test" + testNumber + " failed. IOException while reading filtered file: " + ioe);
}
}
f.delete();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
index 06a18cc..258688d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
@@ -234,7 +234,7 @@ public class FixCrLfTest {
public void assertEqualContent(File expect, File result)
throws AssertionFailedError, IOException {
if (!result.exists()) {
- fail("Expected file "+result+" doesn\'t exist");
+ fail("Expected file " + result + " doesn\'t exist");
}
InputStream inExpect = null;
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/GUnzipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/GUnzipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/GUnzipTest.java
index fc731f7..a7aac5d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/GUnzipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/GUnzipTest.java
@@ -17,6 +17,8 @@
*/
package org.apache.tools.ant.taskdefs;
+import java.io.IOException;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.FileUtilities;
@@ -64,28 +66,28 @@ public class GUnzipTest {
}
@Test
- public void testRealTest() throws java.io.IOException {
+ public void testRealTest() throws IOException {
testRealTest("realTest");
}
@Test
- public void testRealTestWithResource() throws java.io.IOException {
+ public void testRealTestWithResource() throws IOException {
testRealTest("realTestWithResource");
}
- private void testRealTest(String target) throws java.io.IOException {
+ private void testRealTest(String target) throws IOException {
buildRule.executeTarget(target);
assertEquals(FileUtilities.getFileContents(buildRule.getProject().resolveFile("../asf-logo.gif")),
FileUtilities.getFileContents(buildRule.getProject().resolveFile("asf-logo.gif")));
}
@Test
- public void testTestGzipTask() throws java.io.IOException {
+ public void testTestGzipTask() throws IOException {
testRealTest("testGzipTask");
}
@Test
- public void testDocumentationClaimsOnCopy() throws java.io.IOException {
+ public void testDocumentationClaimsOnCopy() throws IOException {
testRealTest("testDocumentationClaimsOnCopy");
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
index 6319317..76342b8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/GzipTest.java
@@ -82,7 +82,7 @@ public class GzipTest {
}
@Test
- public void testGZip(){
+ public void testGZip() {
buildRule.executeTarget("realTest");
String log = buildRule.getLog();
assertTrue("Expecting message starting with 'Building:' but got '"
@@ -92,12 +92,12 @@ public class GzipTest {
}
@Test
- public void testResource(){
+ public void testResource() {
buildRule.executeTarget("realTestWithResource");
}
@Test
- public void testDateCheck(){
+ public void testDateCheck() {
buildRule.executeTarget("testDateCheck");
String log = buildRule.getLog();
assertTrue(
@@ -106,7 +106,7 @@ public class GzipTest {
}
@After
- public void tearDown(){
+ public void tearDown() {
buildRule.executeTarget("cleanup");
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
index 5fdf8a4..40a52cd 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ImportTest.java
@@ -90,8 +90,9 @@ public class ImportTest {
try {
buildRule.executeTarget("do-import");
fail("Build exception should have been thrown as import only allowed in top level task");
- } catch(BuildException ex) {
- assertContains( "not a top level task", "import only allowed as a top-level task", ex.getMessage());
+ } catch (BuildException ex) {
+ assertContains("not a top level task", "import only allowed as a top-level task",
+ ex.getMessage());
}
}
@@ -111,7 +112,8 @@ public class ImportTest {
"src/etc/testcases/taskdefs/import/same_target.xml");
fail("Expected build exception");
} catch (BuildException ex) {
- assertContains("Message did not contain expected contents", "Duplicate target", ex.getMessage());
+ assertContains("Message did not contain expected contents", "Duplicate target",
+ ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
index 1c6fa94..0a26606 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
@@ -137,7 +137,7 @@ public class JarTest {
// move the modified date back a couple of seconds rather than delay the test on each run
Assume.assumeTrue(jarFile.setLastModified(jarFile.lastModified()
- - (FileUtils.getFileUtils().getFileTimestampGranularity() * 3)));
+ - FileUtils.getFileUtils().getFileTimestampGranularity() * 3));
long jarModifiedDate = jarFile.lastModified();
buildRule.executeTarget(secondTarget);
@@ -169,13 +169,13 @@ public class JarTest {
private void testRecreate(String firstTarget, String secondTarget) {
//Move the modified date on all input back a couple of seconds rather then delay the test to achieve a similar effect
- FileUtilities.rollbackTimetamps(buildRule.getProject().getBaseDir(), 5);
+ FileUtilities.rollbackTimestamps(buildRule.getProject().getBaseDir(), 5);
buildRule.executeTarget(firstTarget);
File jarFile = new File(getOutputDir(), tempJar);
//Move the modified date back a couple of seconds rather then delay the test to achieve a similar effect
- FileUtilities.rollbackTimetamps(buildRule.getOutputDir(), 5);
+ FileUtilities.rollbackTimestamps(buildRule.getOutputDir(), 5);
long jarModifiedDate = jarFile.lastModified();
buildRule.executeTarget(secondTarget);
@@ -334,7 +334,7 @@ public class JarTest {
public void testNoVersionInfoFail() {
try {
buildRule.executeTarget("testNoVersionInfoFail");
- fail("BuildException expected: Manifest Implemention information missing.");
+ fail("BuildException expected: Manifest Implementation information missing.");
} catch (BuildException ex) {
assertContains("No Implementation-Title set.", ex.getMessage());
}
@@ -343,33 +343,33 @@ public class JarTest {
@Test
public void testNoVersionInfoIgnore() {
buildRule.executeTarget("testNoVersionInfoIgnore");
- assertTrue(buildRule.getFullLog().indexOf("No Implementation-Title set.") > -1 );
- assertTrue(buildRule.getFullLog().indexOf("No Implementation-Version set.") > -1 );
- assertTrue(buildRule.getFullLog().indexOf("No Implementation-Vendor set.") > -1 );
+ assertTrue(buildRule.getFullLog().indexOf("No Implementation-Title set.") > -1);
+ assertTrue(buildRule.getFullLog().indexOf("No Implementation-Version set.") > -1);
+ assertTrue(buildRule.getFullLog().indexOf("No Implementation-Vendor set.") > -1);
}
@Test
public void testNoVersionInfoWarn() {
buildRule.executeTarget("testNoVersionInfoWarn");
- assertTrue(buildRule.getLog().indexOf("No Implementation-Title set.") > -1 );
- assertTrue(buildRule.getLog().indexOf("No Implementation-Version set.") > -1 );
- assertTrue(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1 );
+ assertTrue(buildRule.getLog().indexOf("No Implementation-Title set.") > -1);
+ assertTrue(buildRule.getLog().indexOf("No Implementation-Version set.") > -1);
+ assertTrue(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1);
}
@Test
public void testNoVersionInfoNoStrict() {
buildRule.executeTarget("testNoVersionInfoNoStrict");
- assertFalse(buildRule.getLog().indexOf("No Implementation-Title set.") > -1 );
- assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1 );
- assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1 );
+ assertFalse(buildRule.getLog().indexOf("No Implementation-Title set.") > -1);
+ assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1);
+ assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1);
}
@Test
public void testHasVersionInfo() {
buildRule.executeTarget("testHasVersionInfo");
- assertFalse(buildRule.getLog().indexOf("No Implementation-Title set.") > -1 );
- assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1 );
- assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1 );
+ assertFalse(buildRule.getLog().indexOf("No Implementation-Title set.") > -1);
+ assertFalse(buildRule.getLog().indexOf("No Implementation-Version set.") > -1);
+ assertFalse(buildRule.getLog().indexOf("No Implementation-Vendor set.") > -1);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
index 8d99571..ea1bdbf 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
@@ -78,14 +78,15 @@ public class JavaTest {
//final String propname="tests-classpath.value";
//String testClasspath=System.getProperty(propname);
- //System.out.println("Test cp="+testClasspath);
- String runFatal=System.getProperty("junit.run.fatal.tests");
- if(runFatal!=null)
- runFatalTests=true;
+ //System.out.println("Test cp=" + testClasspath);
+ String runFatal = System.getProperty("junit.run.fatal.tests");
+ if (runFatal != null) {
+ runFatalTests = true;
+ }
}
@Test
- public void testNoJarNoClassname(){
+ public void testNoJarNoClassname() {
try {
buildRule.executeTarget("testNoJarNoClassname");
fail("Build exception should have been thrown - parameter validation");
@@ -173,20 +174,20 @@ public class JavaTest {
assertEquals("Command line should have 5 elements", 5, cmdLine.length);
assertEquals("Last command line element should be java argument: " + arg,
arg,
- cmdLine[cmdLine.length-1]);
+ cmdLine[cmdLine.length - 1]);
assertEquals("The command line element at index 3 should be module name: " + moduleName,
moduleName,
- cmdLine[cmdLine.length-2]);
+ cmdLine[cmdLine.length - 2]);
assertEquals("The command line element at index 2 should be -m",
"-m",
- cmdLine[cmdLine.length-3]);
+ cmdLine[cmdLine.length - 3]);
}
@Test
public void testModuleAndClassnameCommandLine() {
final String moduleName = "TestModule"; //NOI18N
final String className = "org.apache.Test"; //NOI18N
- final String moduleClassPair= String.format("%s/%s", moduleName, className);
+ final String moduleClassPair = String.format("%s/%s", moduleName, className);
final String arg = "appArg"; //NOI18N
final Java java = new Java();
java.setFork(true);
@@ -199,13 +200,13 @@ public class JavaTest {
assertEquals("Command line should have 5 elements", 5, cmdLine.length);
assertEquals("Last command line element should be java argument: " + arg,
arg,
- cmdLine[cmdLine.length-1]);
+ cmdLine[cmdLine.length - 1]);
assertEquals("The command line element at index 3 should be module class pair: " + moduleClassPair,
moduleClassPair,
- cmdLine[cmdLine.length-2]);
+ cmdLine[cmdLine.length - 2]);
assertEquals("The command line element at index 2 should be -m",
"-m",
- cmdLine[cmdLine.length-3]);
+ cmdLine[cmdLine.length - 3]);
}
@Test
@@ -395,7 +396,7 @@ public class JavaTest {
// wait a little bit for the task to wait for input
Thread.sleep(100);
- // write some stuff in the input stream to be catched by the input task
+ // write some stuff in the input stream to be caught by the input task
out.write("foo\n".getBytes());
out.flush();
try {
@@ -459,21 +460,21 @@ public class JavaTest {
* argv[1] = string to print to System.err (optional)
*/
public static void main(String[] argv) {
- int exitCode=0;
- if(argv.length>0) {
+ int exitCode = 0;
+ if (argv.length > 0) {
try {
- exitCode=Integer.parseInt(argv[0]);
- } catch(NumberFormatException nfe) {
- exitCode=-1;
+ exitCode = Integer.parseInt(argv[0]);
+ } catch (NumberFormatException nfe) {
+ exitCode = -1;
}
}
- if(argv.length>1) {
+ if (argv.length > 1) {
System.out.println(argv[1]);
}
- if(argv.length>2) {
+ if (argv.length > 2) {
System.err.println(argv[2]);
}
- if(exitCode!=0) {
+ if (exitCode != 0) {
System.exit(exitCode);
}
}
@@ -503,8 +504,7 @@ public class JavaTest {
if (argv.length >= 1) {
sleepTime = Integer.parseInt(argv[0]);
}
- if (argv.length >= 2)
- {
+ if (argv.length >= 2) {
logFile = argv[1];
}
OutputStreamWriter out = null;
@@ -515,9 +515,13 @@ public class JavaTest {
FileOutputStream fos = new FileOutputStream(dest);
out = new OutputStreamWriter(fos);
out.write("bye bye\n");
- } catch (Exception ex) {}
- finally {
- try {out.close();} catch (IOException ioe) {}}
+ } catch (Exception ex) {
+ } finally {
+ try {
+ out.close();
+ } catch (IOException ioe) {
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
index 67e31e9..845393d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavacTest.java
@@ -304,7 +304,7 @@ public class JavacTest {
final File tmp = new File(System.getProperty("java.io.tmpdir")); //NOI18N
final File destDir = new File(tmp, String.format("%stestMP%d",
getClass().getName(),
- System.currentTimeMillis()/1000));
+ System.currentTimeMillis() / 1000));
destDir.mkdirs();
try {
final Path p = new Path(project);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
index ce166d9..48f47b8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/LoadFileTest.java
@@ -38,19 +38,16 @@ public class LoadFileTest {
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
-
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/taskdefs/loadfile.xml");
}
-
@After
public void tearDown() {
buildRule.executeTarget("cleanup");
}
-
/**
* A unit test for JUnit
*/
@@ -64,7 +61,6 @@ public class LoadFileTest {
}
}
-
/**
* A unit test for JUnit
*/
@@ -78,7 +74,6 @@ public class LoadFileTest {
}
}
-
/**
* A unit test for JUnit
*/
@@ -96,32 +91,27 @@ public class LoadFileTest {
* A unit test for JUnit
*/
@Test
- public void testFailOnError()
- throws BuildException {
+ public void testFailOnError() throws BuildException {
buildRule.executeTarget("testFailOnError");
assertNull(buildRule.getProject().getProperty("testFailOnError"));
}
-
/**
* A unit test for JUnit
*/
@Test
- public void testLoadAFile()
- throws BuildException {
+ public void testLoadAFile() throws BuildException {
buildRule.executeTarget("testLoadAFile");
if(buildRule.getProject().getProperty("testLoadAFile").indexOf("eh?")<0) {
fail("property is not all in the file");
}
}
-
/**
* A unit test for JUnit
*/
@Test
- public void testLoadAFileEnc()
- throws BuildException {
+ public void testLoadAFileEnc() throws BuildException {
buildRule.executeTarget("testLoadAFileEnc");
assertNotNull("file load files", buildRule.getProject().getProperty("testLoadAFileEnc"));
}
@@ -130,8 +120,7 @@ public class LoadFileTest {
* A unit test for JUnit
*/
@Test
- public void testEvalProps()
- throws BuildException {
+ public void testEvalProps() throws BuildException {
buildRule.executeTarget("testEvalProps");
if(buildRule.getProject().getProperty("testEvalProps").indexOf("rain")<0) {
fail("property eval broken");
@@ -142,8 +131,7 @@ public class LoadFileTest {
* Test FilterChain and FilterReaders
*/
@Test
- public void testFilterChain()
- throws BuildException {
+ public void testFilterChain() throws BuildException {
buildRule.executeTarget("testFilterChain");
if(buildRule.getProject().getProperty("testFilterChain").indexOf("World!")<0) {
fail("Filter Chain broken");
@@ -154,8 +142,7 @@ public class LoadFileTest {
* Test StripJavaComments filterreader functionality.
*/
@Test
- public final void testStripJavaComments()
- throws BuildException {
+ public final void testStripJavaComments() throws BuildException {
buildRule.executeTarget("testStripJavaComments");
final String expected = buildRule.getProject().getProperty("expected");
final String generated = buildRule.getProject().getProperty("testStripJavaComments");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
index 07e53fd..592f1d7 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MakeUrlTest.java
@@ -100,7 +100,7 @@ public class MakeUrlTest {
/**
* test that we can round trip by opening a url that exists
*
- * @throws IOException
+ * @throws IOException if something goes wrong
*/
@Test
public void testRoundTrip() throws IOException {
@@ -142,8 +142,8 @@ public class MakeUrlTest {
/**
* assert that a property ends with
*
- * @param property
- * @param ending
+ * @param property String
+ * @param ending String
*/
private void assertPropertyEndsWith(String property, String ending) {
String result = getProperty(property);
@@ -167,8 +167,8 @@ public class MakeUrlTest {
/**
* get a property from the project
*
- * @param property
- * @return
+ * @param property String
+ * @return String
*/
protected String getProperty(String property) {
return buildRule.getProject().getProperty(property);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
index 695d45c..6fb3d13 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.taskdefs;
-
import static org.apache.tools.ant.AntAssert.assertContains;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -231,8 +230,8 @@ public class ManifestClassPathTest {
} else {
altDriveLetter = "C";
}
- new java.io.File(altDriveLetter + ":/foo.txt").getCanonicalPath();
- } catch (java.io.IOException e) {
+ new File(altDriveLetter + ":/foo.txt").getCanonicalPath();
+ } catch (IOException e) {
Assume.assumeNoException("Drive " + altDriveLetter + ": doesn't exist or is not ready", e);
}
buildRule.getProject().setProperty("altDriveLetter", altDriveLetter);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
index 6e79432..e5a1aa7 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
@@ -58,11 +58,11 @@ public class ManifestTest {
"OfCourseTheAnswerIsThatIsWhatTheSpecRequiresAndIfAnythingHas" +
"AProblemWithThatItIsNotABugInAnt";
- public static final String LONG_70_NAME
+ public static final String LONG_70_NAME
= "ThisNameIsJustSeventyCharactersWhichIsAllowedAccordingToTheSpecsFiller";
- public static final String LONG_68_NAME
+ public static final String LONG_68_NAME
= "ThisNameIsJustSixtyEightCharactersWhichIsAllowedAccordingToTheSpecsX";
- public static final String NOT_LONG_NAME
+ public static final String NOT_LONG_NAME
= "NameIsJustUnderSeventyCharactersWhichIsAllowedAccordingTheSpec";
public static final String VALUE = "NOT_LONG";
@@ -134,9 +134,8 @@ public class ManifestTest {
@Test
public void test5() {
buildRule.executeTarget("test5");
- String output = buildRule.getLog();
- boolean hasWarning = output.indexOf("Manifest warning: \"Name\" attributes should not occur in the main section") != -1;
- assertTrue("Expected warning about Name in main section", hasWarning);
+ assertTrue("Expected warning about Name in main section", buildRule.getLog()
+ .contains("Manifest warning: \"Name\" attributes should not occur in the main section"));
}
/**
@@ -150,9 +149,8 @@ public class ManifestTest {
} catch (BuildException ex) {
assertContains("Invalid Manifest", ex.getMessage());
}
- String output = buildRule.getLog();
- boolean hasWarning = output.indexOf("Manifest sections should start with a \"Name\" attribute") != -1;
- assertTrue("Expected warning about section not starting with Name: attribute", hasWarning);
+ assertTrue("Expected warning about section not starting with Name: attribute", buildRule.getLog()
+ .contains("Manifest sections should start with a \"Name\" attribute"));
}
@@ -162,9 +160,8 @@ public class ManifestTest {
@Test
public void test7() {
buildRule.executeTarget("test7");
-
- boolean hasWarning = buildRule.getLog().indexOf(Manifest.ERROR_FROM_FORBIDDEN) != -1;
- assertTrue("Expected warning about From: attribute", hasWarning);
+ assertTrue("Expected warning about From: attribute", buildRule.getLog()
+ .contains(Manifest.ERROR_FROM_FORBIDDEN));
}
/**
@@ -245,7 +242,8 @@ public class ManifestTest {
buildRule.executeTarget("test13");
fail("BuildException expected: Duplicate Attribute");
} catch (BuildException ex) {
- assertContains("The attribute \"Test\" may not occur more than once in the same section", ex.getMessage());
+ assertContains("The attribute \"Test\" may not occur more than once in the same section",
+ ex.getMessage());
}
}
@@ -269,9 +267,9 @@ public class ManifestTest {
public void testLongLine() throws IOException, ManifestException {
Project p = buildRule.getProject();
p.setUserProperty("test.longline", LONG_LINE);
- p.setUserProperty("test.long68name" , LONG_68_NAME);
- p.setUserProperty("test.long70name" , LONG_70_NAME);
- p.setUserProperty("test.notlongname" , NOT_LONG_NAME);
+ p.setUserProperty("test.long68name", LONG_68_NAME);
+ p.setUserProperty("test.long70name", LONG_70_NAME);
+ p.setUserProperty("test.notlongname", NOT_LONG_NAME);
p.setUserProperty("test.value", VALUE);
buildRule.executeTarget("testLongLine");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
index 637face..9864a4a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MkdirTest.java
@@ -17,6 +17,8 @@
*/
package org.apache.tools.ant.taskdefs;
+import java.io.File;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildFileRule;
import org.junit.Before;
@@ -60,7 +62,7 @@ public class MkdirTest {
@Test
public void test3() {
buildRule.executeTarget("test3");
- java.io.File f = new java.io.File(buildRule.getProject().getProperty("output"), "testdir.tmp");
+ File f = new File(buildRule.getProject().getProperty("output"), "testdir.tmp");
if (!f.exists() || !f.isDirectory()) {
fail("mkdir failed");
} else {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
index 0537c0a..9f5a799 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
@@ -35,7 +35,7 @@ import static org.junit.Assert.assertTrue;
*
*/
public class MoveTest {
-
+
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java
index 95f9eaf..2273ef2 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
*/
public class MultiMapTest {
-
+
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
@@ -68,12 +68,17 @@ public class MultiMapTest {
}
public static class TestMapper implements FileNameMapper {
- public TestMapper() {}
- public void setFrom(String from) {}
- public void setTo(String to) {}
+ public TestMapper() {
+ }
+
+ public void setFrom(String from) {
+ }
+
+ public void setTo(String to) {
+ }
+
public String[] mapFileName(final String source_file_name) {
- return new String[] {
- source_file_name, source_file_name+".copy2" };
+ return new String[] {source_file_name, source_file_name + ".copy2"};
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java
index 3ca7cf7..97667e4 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ParallelTest.java
@@ -46,7 +46,7 @@ public class ParallelTest {
/** Standard property value for the fail test */
public final static String FAILURE_MESSAGE = "failure";
- /** the build fiel associated with this test */
+ /** the build file associated with this test */
public final static String TEST_BUILD_FILE
= "src/etc/testcases/taskdefs/parallel.xml";
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java
index 31a516e..41096b6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/PathConvertTest.java
@@ -36,7 +36,7 @@ public class PathConvertTest {
private static final String BUILD_PATH = "src/etc/testcases/taskdefs/";
private static final String BUILD_FILENAME = "pathconvert.xml";
private static final String BUILD_FILE = BUILD_PATH + BUILD_FILENAME;
-
+
@Before
public void setUp() {
buildRule.configureProject(BUILD_FILE);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
index 17e7114..7cead66 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/PropertyTest.java
@@ -66,8 +66,7 @@ public class PropertyTest {
try {
buildRule.executeTarget("test3");
fail("Did not throw exception on circular exception");
- }
- catch (BuildException e) {
+ } catch (BuildException e) {
assertTrue("Circular definition not detected - ",
e.getMessage().indexOf("was circularly defined") != -1);
}
@@ -101,8 +100,7 @@ public class PropertyTest {
try {
buildRule.executeTarget("prefix.fail");
fail("Did not throw exception on invalid use of prefix");
- }
- catch (BuildException e) {
+ } catch (BuildException e) {
assertContains("Prefix allowed on non-resource/file load - ",
"Prefix is only valid", e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
index 27b3c8c..c83a772 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ProtectedJarMethodsTest.java
@@ -99,8 +99,8 @@ public class ProtectedJarMethodsTest {
@Test
public void testFindJarNameLongestMatchWins() {
assertEquals("lib/foo",
- Jar.findJarName("lib/foo",
- new String[] {"foo", "lib/foo",
+ Jar.findJarName("lib/foo",
+ new String[] {"foo", "lib/foo",
"lib/bar/foo"}));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java
index c4806cd..fb6f118 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/RecorderTest.java
@@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue;
/**
*/
public class RecorderTest {
-
+
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
index cd485d0..4e40c28 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
@@ -153,7 +153,7 @@ public class ReplaceTest {
public void assertEqualContent(File expect, File result)
throws AssertionFailedError, IOException {
if (!result.exists()) {
- fail("Expected file "+result+" doesn\'t exist");
+ fail("Expected file " + result + " doesn\'t exist");
}
InputStream inExpect = null;
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
index 3753b68..2748cf2 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
@@ -282,7 +282,7 @@ public class RmicAdvancedTest {
public void NotestFailingAdapter() throws Exception {
try {
buildRule.executeTarget("testFailingAdapter");
- fail("Expected failures to propogate");
+ fail("Expected failures to propagate");
} catch (BuildException ex) {
AntAssert.assertContains(Rmic.ERROR_RMIC_FAILED, ex.getMessage());
}
@@ -291,7 +291,7 @@ public class RmicAdvancedTest {
/**
* test that version 1.1 stubs are good
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testVersion11() throws Exception {
@@ -300,7 +300,7 @@ public class RmicAdvancedTest {
/**
* test that version 1.1 stubs are good
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testVersion11Dest() throws Exception {
@@ -310,7 +310,7 @@ public class RmicAdvancedTest {
/**
* test that version 1.2 stubs are good
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testVersion12() throws Exception {
@@ -320,7 +320,7 @@ public class RmicAdvancedTest {
/**
* test that version 1.2 stubs are good
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testVersion12Dest() throws Exception {
@@ -330,7 +330,7 @@ public class RmicAdvancedTest {
/**
* test that version compat stubs are good
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testVersionCompat() throws Exception {
@@ -340,7 +340,7 @@ public class RmicAdvancedTest {
/**
* test that version compat stubs are good
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testVersionCompatDest() throws Exception {
@@ -372,7 +372,7 @@ public class RmicAdvancedTest {
/**
* test that passes -Xnew to sun's rmic running in a different VM.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testXnewForked() throws Exception {
@@ -382,7 +382,7 @@ public class RmicAdvancedTest {
/**
* test that passes -Xnew to sun's rmic running in a different VM.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testXnewForkedDest() throws Exception {
@@ -392,7 +392,7 @@ public class RmicAdvancedTest {
/**
* test that runs the new xnew compiler adapter.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testXnewCompiler() throws Exception {
@@ -402,7 +402,7 @@ public class RmicAdvancedTest {
/**
* test that runs the new xnew compiler adapter.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testXnewCompilerDest() throws Exception {
@@ -412,7 +412,7 @@ public class RmicAdvancedTest {
/**
* test that verifies that IDL compiles.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testIDL() throws Exception {
@@ -422,7 +422,7 @@ public class RmicAdvancedTest {
/**
* test that verifies that IDL compiles.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testIDLDest() throws Exception {
@@ -432,7 +432,7 @@ public class RmicAdvancedTest {
/**
* test that verifies that IIOP compiles.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testIIOP() throws Exception {
@@ -442,7 +442,7 @@ public class RmicAdvancedTest {
/**
* test that verifies that IIOP compiles.
*
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testIIOPDest() throws Exception {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java
index 8d3200c..a8ef90c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicTest.java
@@ -88,7 +88,7 @@ public class RmicTest {
// check defaults
String compiler = rmic.getCompiler();
assertNotNull(compiler);
- assertEquals("expected sun or kaffe, but found "+compiler,compiler,"default");
+ assertEquals("expected sun or kaffe, but found " + compiler, compiler,"default");
project.setNewProperty("build.rmic", "weblogic");
compiler = rmic.getCompiler();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
index fbce8a6..dac6941 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
@@ -26,8 +26,8 @@ import java.io.File;
import java.net.URL;
import java.util.logging.Logger;
-import org.apache.tools.ant.Project;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -70,13 +70,13 @@ public class SQLExecTest {
// simple test to ensure that the caching does work...
@Test
- public void testDriverCaching(){
+ public void testDriverCaching() {
SQLExec sql = createTask(getProperties(NULL));
assertTrue(!SQLExec.getLoaderMap().containsKey(NULL_DRIVER));
try {
sql.execute();
fail("BuildException should have been thrown");
- } catch (BuildException e){
+ } catch (BuildException e) {
assertContains("No suitable Driver", e.getMessage());
}
assertTrue(SQLExec.getLoaderMap().containsKey(NULL_DRIVER));
@@ -104,13 +104,13 @@ public class SQLExecTest {
@Ignore
@Test
- public void testOracle(){
+ public void testOracle() {
doMultipleCalls(1000, ORACLE, true, false);
}
@Ignore
@Test
- public void testMySQL(){
+ public void testMySQL() {
doMultipleCalls(1000, MYSQL, true, false);
}
@@ -122,15 +122,15 @@ public class SQLExecTest {
* @param caching should caching be enabled ?
* @param catchexception true to catch exception for each call, false if not.
*/
- protected void doMultipleCalls(int calls, int database, boolean caching, boolean catchexception){
+ protected void doMultipleCalls(int calls, int database, boolean caching, boolean catchexception) {
Properties props = getProperties(database);
- for (int i = 0; i < calls; i++){
+ for (int i = 0; i < calls; i++) {
SQLExec sql = createTask(props);
sql.setCaching(caching);
try {
sql.execute();
- } catch (BuildException e){
- if (!catchexception){
+ } catch (BuildException e) {
+ if (!catchexception) {
throw e;
}
}
@@ -141,15 +141,15 @@ public class SQLExecTest {
* Create a task from a set of properties
* @see #getProperties(int)
*/
- protected SQLExec createTask(Properties props){
+ protected SQLExec createTask(Properties props) {
SQLExec sql = new SQLExec();
- sql.setProject( new Project() );
- sql.setDriver( props.getProperty(DRIVER) );
- sql.setUserid( props.getProperty(USER) );
- sql.setPassword( props.getProperty(PASSWORD) );
- sql.setUrl( props.getProperty(URL) );
- sql.createClasspath().setLocation( new File(props.getProperty(PATH)) );
- sql.addText( props.getProperty(SQL) );
+ sql.setProject(new Project());
+ sql.setDriver(props.getProperty(DRIVER));
+ sql.setUserid(props.getProperty(USER));
+ sql.setPassword(props.getProperty(PASSWORD));
+ sql.setUrl(props.getProperty(URL));
+ sql.createClasspath().setLocation(new File(props.getProperty(PATH)));
+ sql.addText(props.getProperty(SQL));
return sql;
}
@@ -157,7 +157,7 @@ public class SQLExecTest {
* try to find the path from a resource (jar file or directory name)
* so that it can be used as a classpath to load the resource.
*/
- protected String findResourcePath(String resource){
+ protected String findResourcePath(String resource) {
resource = resource.replace('.', '/') + ".class";
URL url = getClass().getClassLoader().getResource(resource);
if (url == null) {
@@ -180,9 +180,9 @@ public class SQLExecTest {
* tweak this to make it run or add your own database.
* The driver lib should be dropped into the system classloader.
*/
- protected Properties getProperties(int database){
+ protected Properties getProperties(int database) {
Properties props = null;
- switch (database){
+ switch (database) {
case ORACLE:
props = getProperties("oracle.jdbc.driver.OracleDriver", "test", "test", "jdbc:oracle:thin:@127.0.0.1:1521:orcl");
break;
@@ -201,7 +201,7 @@ public class SQLExecTest {
}
/** helper method to build properties */
- protected Properties getProperties(String driver, String user, String pwd, String url){
+ protected Properties getProperties(String driver, String user, String pwd, String url) {
Properties props = new Properties();
props.put(DRIVER, driver);
props.put(USER, user);