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:28 UTC
[1/6] ant git commit: Checkstyle: mostly whitespace (cf master)
Repository: ant
Updated Branches:
refs/heads/1.9.x 0ed7f4ab5 -> 572a24902
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
index bf5b0d4..59d3ec6 100644
--- a/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/StringUtilsTest.java
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertTrue;
public class StringUtilsTest {
@Test
- public void testSplit(){
+ public void testSplit() {
final String data = "a,b,,";
Vector res = StringUtils.split(data, ',');
assertEquals(4, res.size());
@@ -42,7 +42,7 @@ public class StringUtilsTest {
}
@Test
- public void testSplitLines(){
+ public void testSplitLines() {
final String data = "a\r\nb\nc\nd\ne";
Vector res = StringUtils.lineSplit(data);
assertEquals(5, res.size());
@@ -62,42 +62,42 @@ public class StringUtilsTest {
@Test
public void testEndsWithBothEmpty() {
- assertTrue( StringUtils.endsWith( new StringBuffer(), "") );
+ assertTrue(StringUtils.endsWith(new StringBuffer(), ""));
}
@Test
public void testEndsWithEmptyString() {
- assertTrue( StringUtils.endsWith( new StringBuffer("12234545"), "") );
+ assertTrue(StringUtils.endsWith(new StringBuffer("12234545"), ""));
}
@Test
public void testEndsWithShorterString() {
- assertTrue( StringUtils.endsWith( new StringBuffer("12345678"), "78"));
+ assertTrue(StringUtils.endsWith(new StringBuffer("12345678"), "78"));
}
@Test
public void testEndsWithSameString() {
- assertTrue( StringUtils.endsWith( new StringBuffer("123"), "123"));
+ assertTrue(StringUtils.endsWith(new StringBuffer("123"), "123"));
}
@Test
public void testEndsWithLongerString() {
- assertFalse( StringUtils.endsWith( new StringBuffer("12"), "1245"));
+ assertFalse(StringUtils.endsWith(new StringBuffer("12"), "1245"));
}
@Test
public void testEndsWithNoMatch() {
- assertFalse( StringUtils.endsWith( new StringBuffer("12345678"), "789"));
+ assertFalse(StringUtils.endsWith(new StringBuffer("12345678"), "789"));
}
@Test
public void testEndsWithEmptyBuffer() {
- assertFalse( StringUtils.endsWith( new StringBuffer(""), "12345667") );
+ assertFalse(StringUtils.endsWith(new StringBuffer(""), "12345667"));
}
@Test
public void testEndsWithJDKPerf() {
- StringBuffer buf = getFilledBuffer(1024*300, 'a');
+ StringBuffer buf = getFilledBuffer(1024 * 300, 'a');
for (int i = 0; i < 1000; i++) {
assertTrue(buf.toString().endsWith("aa"));
}
@@ -105,7 +105,7 @@ public class StringUtilsTest {
@Test
public void testEndsWithPerf() {
- StringBuffer buf = getFilledBuffer(1024*300, 'a');
+ StringBuffer buf = getFilledBuffer(1024 * 300, 'a');
for (int i = 0; i < 1000; i++) {
assertTrue(StringUtils.endsWith(buf, "aa"));
}
@@ -113,7 +113,9 @@ public class StringUtilsTest {
private StringBuffer getFilledBuffer(int size, char ch) {
StringBuffer buf = new StringBuffer(size);
- for (int i = 0; i < size; i++) { buf.append(ch); };
+ for (int i = 0; i < size; i++) {
+ buf.append(ch);
+ }
return buf;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java b/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
index 7586950..c59154d 100644
--- a/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/UnPackageNameMapperTest.java
@@ -29,7 +29,7 @@ public class UnPackageNameMapperTest {
UnPackageNameMapper mapper = new UnPackageNameMapper();
mapper.setFrom("TEST-*.xml");
mapper.setTo("*.java");
- String file ="TEST-org.apache.tools.ant.util.UnPackageNameMapperTest.xml";
+ String file = "TEST-org.apache.tools.ant.util.UnPackageNameMapperTest.xml";
String result = mapper.mapFileName(file)[0];
String expected = fixupPath("org/apache/tools/ant/util/UnPackageNameMapperTest.java");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
index 3340b59..b93beb3 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java
@@ -59,5 +59,6 @@ public class JakartaRegexpMatcherTest extends RegexpMatcherTest {
/**
* Fails for "default" mode.
*/
- protected void doEndTest2(String text) {}
+ protected void doEndTest2(String text) {
+ }
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
index 078fbb1..8edc13c 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/JakartaRegexpRegexpTest.java
@@ -40,7 +40,7 @@ public class JakartaRegexpRegexpTest extends RegexpTest {
try {
super.testWindowsLineSeparator2();
fail("Should trigger when this bug is fixed. {@since 1.2}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -51,12 +51,13 @@ public class JakartaRegexpRegexpTest extends RegexpTest {
try {
super.testUnixLineSeparator();
fail("Should trigger once this bug is fixed. {@since 1.2}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
/**
* Fails for "default" mode.
*/
- protected void doEndTest2(String text) {}
+ protected void doEndTest2(String text) {
+ }
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
index c042e71..40f6dca 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java
@@ -40,7 +40,7 @@ public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
try {
super.testParagraphCharacter();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -48,7 +48,7 @@ public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
try {
super.testLineSeparatorCharacter();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -56,7 +56,7 @@ public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
try {
super.testStandaloneCR();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -64,7 +64,7 @@ public class Jdk14RegexpMatcherTest extends RegexpMatcherTest {
try {
super.testWindowsLineSeparator();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
index 2b60406..5f5342e 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexpTest.java
@@ -40,7 +40,7 @@ public class Jdk14RegexpRegexpTest extends RegexpTest {
try {
super.testParagraphCharacter();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -48,7 +48,7 @@ public class Jdk14RegexpRegexpTest extends RegexpTest {
try {
super.testLineSeparatorCharacter();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -56,7 +56,7 @@ public class Jdk14RegexpRegexpTest extends RegexpTest {
try {
super.testStandaloneCR();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
@@ -64,7 +64,7 @@ public class Jdk14RegexpRegexpTest extends RegexpTest {
try {
super.testWindowsLineSeparator();
fail("Should trigger once fixed. {@since JDK 1.4RC1}");
- } catch (AssertionFailedError e){
+ } catch (AssertionFailedError e) {
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
index 0950827..3129e68 100644
--- a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
@@ -35,7 +35,9 @@ public abstract class RegexpMatcherTest extends TestCase {
public abstract RegexpMatcher getImplementation();
- protected final RegexpMatcher getReg() {return reg;}
+ protected final RegexpMatcher getReg() {
+ return reg;
+ }
public RegexpMatcherTest(String name) {
super(name);
@@ -152,7 +154,7 @@ public abstract class RegexpMatcherTest extends TestCase {
public void testMultiVersusSingleLine() throws IOException {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("Line1").append(UNIX_LINE);
buf.append("starttest Line2").append(UNIX_LINE);
buf.append("Line3 endtest").append(UNIX_LINE);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java b/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
index 50e0e57..88b500a 100644
--- a/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
+++ b/src/tests/junit/org/apache/tools/bzip2/CBZip2StreamTest.java
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
public class CBZip2StreamTest {
+ @SuppressWarnings("resource")
@Test
public void testNullPointer() throws IOException {
try {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/mail/MailMessageTest.java b/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
index 435729e..3d75826 100644
--- a/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
+++ b/src/tests/junit/org/apache/tools/mail/MailMessageTest.java
@@ -65,7 +65,7 @@ public class MailMessageTest {
* If this testcase takes >90s to complete, it is very likely that
* the two threads are blocked waiting for each other and Thread.join()
* timed out.
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testAPIExample() throws InterruptedException {
@@ -82,8 +82,8 @@ public class MailMessageTest {
testMailClient.cc("cc2@you.com");
testMailClient.bcc("bcc@you.com");
testMailClient.setSubject("Test subject");
- testMailClient.setMessage( "test line 1\n" +
- "test line 2" );
+ testMailClient.setMessage("test line 1\n" +
+ "test line 2");
Thread client = new Thread(testMailClient);
client.start();
@@ -144,7 +144,7 @@ public class MailMessageTest {
/**
* Test a MailMessage with no cc or bcc lines
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testToOnly() throws InterruptedException {
@@ -157,8 +157,8 @@ public class MailMessageTest {
testMailClient.from("Mail Message <Em...@ant.apache.org>");
testMailClient.to("to@you.com");
testMailClient.setSubject("Test subject");
- testMailClient.setMessage( "test line 1\n" +
- "test line 2" );
+ testMailClient.setMessage("test line 1\n" +
+ "test line 2");
Thread client = new Thread(testMailClient);
client.start();
@@ -196,7 +196,7 @@ public class MailMessageTest {
/**
* Test a MailMessage with no to or bcc lines
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testCcOnly() throws InterruptedException {
@@ -209,8 +209,8 @@ public class MailMessageTest {
testMailClient.from("Mail Message <Em...@ant.apache.org>");
testMailClient.cc("cc@you.com");
testMailClient.setSubject("Test subject");
- testMailClient.setMessage( "test line 1\n" +
- "test line 2" );
+ testMailClient.setMessage("test line 1\n" +
+ "test line 2");
Thread client = new Thread(testMailClient);
client.start();
@@ -248,7 +248,7 @@ public class MailMessageTest {
/**
* Test a MailMessage with no to or cc lines
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testBccOnly() throws InterruptedException {
@@ -261,8 +261,8 @@ public class MailMessageTest {
testMailClient.from("Mail Message <Em...@ant.apache.org>");
testMailClient.bcc("bcc@you.com");
testMailClient.setSubject("Test subject");
- testMailClient.setMessage( "test line 1\n" +
- "test line 2" );
+ testMailClient.setMessage("test line 1\n" +
+ "test line 2");
Thread client = new Thread(testMailClient);
client.start();
@@ -291,8 +291,8 @@ public class MailMessageTest {
"250\r\n" +
"QUIT\r\n" +
"221\r\n";
- assertEquals( expectedResult.length(), result.length() );
- assertEquals( expectedResult, result );
+ assertEquals(expectedResult.length(), result.length());
+ assertEquals(expectedResult, result);
assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
}
@@ -300,7 +300,7 @@ public class MailMessageTest {
/**
* Test a MailMessage with no subject line
* Subject is an optional field (RFC 822 s4.1)
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testNoSubject() throws InterruptedException {
@@ -312,8 +312,8 @@ public class MailMessageTest {
testMailClient.from("Mail Message <Em...@ant.apache.org>");
testMailClient.to("to@you.com");
- testMailClient.setMessage( "test line 1\n" +
- "test line 2" );
+ testMailClient.setMessage("test line 1\n" +
+ "test line 2");
Thread client = new Thread(testMailClient);
client.start();
@@ -342,15 +342,15 @@ public class MailMessageTest {
"250\r\n" +
"QUIT\r\n" +
"221\r\n";
- assertEquals( expectedResult.length(), result.length() );
- assertEquals( expectedResult, result );
+ assertEquals(expectedResult.length(), result.length());
+ assertEquals(expectedResult, result);
assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
}
/**
* Test a MailMessage with empty body message
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testEmptyBody() throws InterruptedException {
@@ -402,7 +402,7 @@ public class MailMessageTest {
* Test a MailMessage with US-ASCII character set
* The next four testcase can be kinda hard to debug as Ant will often
* print the junit failure in US-ASCII.
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testAsciiCharset() throws InterruptedException {
@@ -453,22 +453,20 @@ public class MailMessageTest {
bos1.print(expectedResult);
bos2.print(result);
- assertEquals( "expected message length != actual message length "
- + "in testAsciiCharset()", expectedResult.length(), result.length() );
- assertEquals( "baos1 and baos2 should be the same in testAsciiCharset()",
- baos1.toString(), baos2.toString() ); // order of headers cannot be guaranteed
+ assertEquals("expected message length != actual message length "
+ + "in testAsciiCharset()", expectedResult.length(), result.length());
+ assertEquals("baos1 and baos2 should be the same in testAsciiCharset()",
+ baos1.toString(), baos2.toString()); // order of headers cannot be guaranteed
assertFalse(testMailClient.getFailMessage(), testMailClient.isFailed());
}
-
-
/**
* A private test class that pretends to be a mail transfer agent
*/
private class ServerThread implements Runnable {
- private StringBuffer sb = null;
+ private StringBuilder sb = null;
private boolean loop = false;
ServerSocket ssock = null;
Socket sock = null;
@@ -481,45 +479,45 @@ public class MailMessageTest {
try {
ssock = new ServerSocket(TEST_PORT);
sock = ssock.accept(); // wait for connection
- in = new BufferedReader( new InputStreamReader(
- sock.getInputStream()) );
- out = new BufferedWriter( new OutputStreamWriter(
- sock.getOutputStream() ) );
- sb = new StringBuffer();
- send( "220 test SMTP EmailTaskTest\r\n" );
+ in = new BufferedReader(new InputStreamReader(
+ sock.getInputStream()));
+ out = new BufferedWriter(new OutputStreamWriter(
+ sock.getOutputStream()));
+ sb = new StringBuilder();
+ send("220 test SMTP EmailTaskTest\r\n");
loop = true;
- while ( loop ) {
+ while (loop) {
String response = in.readLine();
- if ( response == null ) {
+ if (response == null) {
loop = false;
break;
}
- sb.append( response + "\r\n" );
-
- if ( !data && response.startsWith( "HELO" ) ) {
- send( "250 " + local + " Hello " + local + " " +
- "[127.0.0.1], pleased to meet you\r\n" );
- } else if ( !data && response.startsWith("MAIL") ) {
- send( "250\r\n" );
- } else if ( !data && response.startsWith("RCPT")) {
- send( "250\r\n" );
+ sb.append(response).append("\r\n");
+
+ if (!data && response.startsWith("HELO")) {
+ send("250 " + local + " Hello " + local + " " +
+ "[127.0.0.1], pleased to meet you\r\n");
+ } else if (!data && response.startsWith("MAIL")) {
+ send("250\r\n");
+ } else if (!data && response.startsWith("RCPT")) {
+ send("250\r\n");
} else if (!data && response.startsWith("DATA")) {
- send( "354\r\n" );
+ send("354\r\n");
data = true;
- } else if (data && response.equals(".") ) {
- send( "250\r\n" );
+ } else if (data && response.equals(".")) {
+ send("250\r\n");
data = false;
} else if (!data && response.startsWith("QUIT")) {
- send( "221\r\n" );
+ send("221\r\n");
loop = false;
} else if (!data) {
//throw new IllegalStateException("Command unrecognized: "
// + response);
- send( "500 5.5.1 Command unrecognized: \"" +
- response + "\"\r\n" );
+ send("500 5.5.1 Command unrecognized: \"" +
+ response + "\"\r\n");
loop = false;
} else {
- // sb.append( response + "\r\n" );
+ // sb.append(response + "\r\n");
}
} // while
@@ -531,9 +529,9 @@ public class MailMessageTest {
}
private void send(String retmsg) throws IOException {
- out.write( retmsg );
+ out.write(retmsg);
out.flush();
- sb.append( retmsg );
+ sb.append(retmsg);
}
private void disconnect() {
@@ -653,9 +651,9 @@ public class MailMessageTest {
msg.setSubject(subject);
}
- if (message != null ) {
+ if (message != null) {
PrintStream out = msg.getPrintStream();
- out.println( message );
+ out.println(message);
}
msg.sendAndClose();
@@ -674,6 +672,7 @@ public class MailMessageTest {
return failMessage;
}
+ @SuppressWarnings("unused")
public void replyTo(String replyTo) {
replyToList.add(replyTo);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/tar/TarEntryTest.java b/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
index e942cdb..f5c2020 100644
--- a/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
+++ b/src/tests/junit/org/apache/tools/tar/TarEntryTest.java
@@ -18,6 +18,8 @@
package org.apache.tools.tar;
+import java.io.File;
+
import org.junit.Test;
/**
@@ -30,6 +32,6 @@ public class TarEntryTest {
*/
@Test
public void testFileConstructor() {
- new TarEntry(new java.io.File("/foo"));
+ new TarEntry(new File("/foo"));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java b/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
index 873b3f5..c62e3e1 100644
--- a/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
+++ b/src/tests/junit/org/apache/tools/zip/AsiExtraFieldTest.java
@@ -62,8 +62,8 @@ public class AsiExtraFieldTest implements UnixStat {
0, 0, 0, 0, // link length
5, 0, 6, 0}; // uid, gid
assertEquals("no link", expect.length, b.length);
- for (int i=0; i<expect.length; i++) {
- assertEquals("no link, byte "+i, expect[i], b[i]);
+ for (int i = 0; i < expect.length; i++) {
+ assertEquals("no link, byte " + i, expect[i], b[i]);
}
a.setLinkedFile("test");
@@ -74,8 +74,8 @@ public class AsiExtraFieldTest implements UnixStat {
(byte)'t', (byte)'e', (byte)'s', (byte)'t'};
b = a.getLocalFileDataData();
assertEquals("no link", expect.length, b.length);
- for (int i=0; i<expect.length; i++) {
- assertEquals("no link, byte "+i, expect[i], b[i]);
+ for (int i = 0; i < expect.length; i++) {
+ assertEquals("no link, byte " + i, expect[i], b[i]);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java b/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
index 95a6779..15b1b6d 100644
--- a/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ExtraFieldUtilsTest.java
@@ -61,11 +61,11 @@ public class ExtraFieldUtilsTest implements UnixStat {
System.arraycopy(a.getLocalFileDataLength().getBytes(), 0, data, 2, 2);
System.arraycopy(aLocal, 0, data, 4, aLocal.length);
System.arraycopy(dummy.getHeaderId().getBytes(), 0, data,
- 4+aLocal.length, 2);
+ 4 + aLocal.length, 2);
System.arraycopy(dummy.getLocalFileDataLength().getBytes(), 0, data,
- 4+aLocal.length+2, 2);
+ 4 + aLocal.length + 2, 2);
System.arraycopy(dummyLocal, 0, data,
- 4+aLocal.length+4, dummyLocal.length);
+ 4 + aLocal.length + 4, dummyLocal.length);
}
@@ -83,14 +83,14 @@ public class ExtraFieldUtilsTest implements UnixStat {
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
- byte[] data2 = new byte[data.length-1];
+ byte[] data2 = new byte[data.length - 1];
System.arraycopy(data, 0, data2, 0, data2.length);
try {
ExtraFieldUtils.parse(data2);
fail("data should be invalid");
} catch (Exception e) {
assertEquals("message",
- "bad extra field starting at "+(4 + aLocal.length)
+ "bad extra field starting at " + (4 + aLocal.length)
+ ". Block length of 1 bytes exceeds remaining data of 0 bytes.",
e.getMessage());
}
@@ -109,7 +109,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
- byte[] data2 = new byte[data.length-1];
+ byte[] data2 = new byte[data.length - 1];
System.arraycopy(data, 0, data2, 0, data2.length);
ze = ExtraFieldUtils.parse(data2, true,
ExtraFieldUtils.UnparseableExtraField.READ);
@@ -140,7 +140,7 @@ public class ExtraFieldUtilsTest implements UnixStat {
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
- byte[] data2 = new byte[data.length-1];
+ byte[] data2 = new byte[data.length - 1];
System.arraycopy(data, 0, data2, 0, data2.length);
ze = ExtraFieldUtils.parse(data2, true,
ExtraFieldUtils.UnparseableExtraField.SKIP);
@@ -158,24 +158,24 @@ public class ExtraFieldUtilsTest implements UnixStat {
byte[] local =
ExtraFieldUtils.mergeLocalFileDataData(new ZipExtraField[] {a, dummy});
assertEquals("local length", data.length, local.length);
- for (int i=0; i<local.length; i++) {
- assertEquals("local byte "+i, data[i], local[i]);
+ for (int i = 0; i < local.length; i++) {
+ assertEquals("local byte " + i, data[i], local[i]);
}
byte[] dummyCentral = dummy.getCentralDirectoryData();
byte[] data2 = new byte[4 + aLocal.length + 4 + dummyCentral.length];
System.arraycopy(data, 0, data2, 0, 4 + aLocal.length + 2);
System.arraycopy(dummy.getCentralDirectoryLength().getBytes(), 0,
- data2, 4+aLocal.length+2, 2);
+ data2, 4 + aLocal.length + 2, 2);
System.arraycopy(dummyCentral, 0, data2,
- 4+aLocal.length+4, dummyCentral.length);
+ 4 + aLocal.length + 4, dummyCentral.length);
byte[] central =
ExtraFieldUtils.mergeCentralDirectoryData(new ZipExtraField[] {a, dummy});
assertEquals("central length", data2.length, central.length);
- for (int i=0; i<central.length; i++) {
- assertEquals("central byte "+i, data2[i], central[i]);
+ for (int i = 0; i < central.length; i++) {
+ assertEquals("central byte " + i, data2[i], central[i]);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java b/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
index 0e51e6b..6761e4f 100644
--- a/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
+++ b/src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java
@@ -19,8 +19,8 @@
package org.apache.tools.zip;
import java.io.File;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.Enumeration;
import java.util.zip.CRC32;
@@ -131,11 +131,9 @@ public class UTF8ZipFilesTest {
zos = new ZipOutputStream(file);
zos.setEncoding(encoding);
zos.setUseLanguageEncodingFlag(withEFS);
- zos.setCreateUnicodeExtraFields(withExplicitUnicodeExtra ?
- ZipOutputStream
- .UnicodeExtraFieldPolicy.NEVER
- : ZipOutputStream
- .UnicodeExtraFieldPolicy.ALWAYS);
+ zos.setCreateUnicodeExtraFields(withExplicitUnicodeExtra
+ ? ZipOutputStream.UnicodeExtraFieldPolicy.NEVER
+ : ZipOutputStream.UnicodeExtraFieldPolicy.ALWAYS);
ZipEntry ze = new ZipEntry(OIL_BARREL_TXT);
if (withExplicitUnicodeExtra
@@ -210,7 +208,7 @@ public class UTF8ZipFilesTest {
} else if (ze.getName().endsWith("_for_Dollar.txt")) {
assertUnicodeName(ze, EURO_FOR_DOLLAR_TXT, encoding);
} else if (!ze.getName().equals(ASCII_TXT)) {
- throw new AssertionError("Urecognized ZIP entry with name ["
+ throw new AssertionError("Unrecognized ZIP entry with name ["
+ ze.getName() + "] found.");
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java b/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
index 826e410..a0f9f55 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipEncodingTest.java
@@ -113,10 +113,8 @@ public class ZipEncodingTest {
assertEquals(expected.length, actual.limit());
- for (int i = 0; i < expected.length; ++i) {
-
- byte a = actual.get();
- assertEquals(expected[i], a);
+ for (byte expectedByte : expected) {
+ assertEquals(expectedByte, actual.get());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java b/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
index 3c21f6f..96bbd45 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipEntryTest.java
@@ -62,7 +62,7 @@ public class ZipEntryTest {
assertEquals("second pass", 2, result.length);
assertSame(a, result[0]);
assertSame(u2, result[1]);
- assertEquals("length second pass", data1.length+1, data2.length);
+ assertEquals("length second pass", data1.length + 1, data2.length);
UnrecognizedExtraField u3 = new UnrecognizedExtraField();
u3.setHeaderId(new ZipShort(2));
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/zip/ZipLongTest.java b/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
index a7ece04..12aad02 100644
--- a/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
+++ b/src/tests/junit/org/apache/tools/zip/ZipLongTest.java
@@ -80,7 +80,7 @@ public class ZipLongTest {
@Test
public void testSign() {
ZipLong zl = new ZipLong(new byte[] {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF});
- assertEquals(0x00000000FFFFFFFFl, zl.getValue());
+ assertEquals(0x00000000FFFFFFFFL, zl.getValue());
}
@Test
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/example/junit/MultilineAsserts.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/MultilineAsserts.java b/src/tests/junit/org/example/junit/MultilineAsserts.java
index 06e1039..be68ec6 100644
--- a/src/tests/junit/org/example/junit/MultilineAsserts.java
+++ b/src/tests/junit/org/example/junit/MultilineAsserts.java
@@ -20,8 +20,16 @@ package org.example.junit;
import junit.framework.TestCase;
public class MultilineAsserts extends TestCase {
- public void testFoo() { assertTrue("testFoo \nmessed up", false); }
- public void testBar() { assertTrue("testBar \ndidn't work", true); }
- public void testFee() { assertTrue("testFee \ncrashed", false); }
- public void testFie() { assertTrue("testFie \nbroke", true); }
+ public void testFoo() {
+ assertTrue("testFoo \nmessed up", false);
+ }
+ public void testBar() {
+ assertTrue("testBar \ndidn't work", true);
+ }
+ public void testFee() {
+ assertTrue("testFee \ncrashed", false);
+ }
+ public void testFie() {
+ assertTrue("testFie \nbroke", true);
+ }
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/example/junit/TestNotMissed.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/junit/TestNotMissed.java b/src/tests/junit/org/example/junit/TestNotMissed.java
index 6d3babe..41b722f 100644
--- a/src/tests/junit/org/example/junit/TestNotMissed.java
+++ b/src/tests/junit/org/example/junit/TestNotMissed.java
@@ -17,7 +17,6 @@
*/
package org.example.junit;
-
import org.junit.Test;
public class TestNotMissed {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java b/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
index a566d5c..960ad72 100644
--- a/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
+++ b/src/tests/junit/org/example/tasks/TaskdefTestContainerTask.java
@@ -21,5 +21,6 @@ package org.example.tasks;
import org.apache.tools.ant.taskdefs.Sequential;
public class TaskdefTestContainerTask extends Sequential {
- public TaskdefTestContainerTask() {}
+ public TaskdefTestContainerTask() {
+ }
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java b/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
index fdb48b0..4adad93 100644
--- a/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
+++ b/src/tests/junit/org/example/tasks/TaskdefTestSimpleTask.java
@@ -24,21 +24,28 @@ import org.apache.tools.ant.Task;
public class TaskdefTestSimpleTask extends Task {
public class Echo {
- Echo() {}
+ Echo() {
+ }
+
private String message = null;
- public void setMessage(String s) {message = s;}
+
+ public void setMessage(String s) {
+ message = s;
+ }
}
- public TaskdefTestSimpleTask() {}
+ public TaskdefTestSimpleTask() {
+ }
private Echo echo;
+
public Echo createEcho() {
echo = new Echo();
return echo;
}
public void execute() {
- log("simpletask: "+echo.message, Project.MSG_INFO);
+ log("simpletask: " + echo.message, Project.MSG_INFO);
}
}
[2/6] ant git commit: Checkstyle: mostly whitespace (cf master)
Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java b/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
index 1e43fe1..7ff8565 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
@@ -101,7 +101,7 @@ public class PermissionsTest {
String s = System.getProperty("user.home");
System.setProperty("user.home", s);
fail("Could perform an action that should have been forbidden.");
- } catch (SecurityException e){
+ } catch (SecurityException e) {
// Was expected, test passes
} finally {
perms.restoreSecurityManager();
@@ -115,7 +115,7 @@ public class PermissionsTest {
try {
System.getProperty("os.name");
fail("Could perform an action that should have been forbidden.");
- } catch (SecurityException e){
+ } catch (SecurityException e) {
// Was expected, test passes
} finally {
perms.restoreSecurityManager();
@@ -129,7 +129,7 @@ public class PermissionsTest {
try {
System.setProperty("line.separator",ls);
fail("Could perform an action that should have been forbidden.");
- } catch (SecurityException e){
+ } catch (SecurityException e) {
//TODO assert exception message
// Was expected, test passes
} finally {
@@ -144,7 +144,7 @@ public class PermissionsTest {
try {
System.out.println("If this is the last line on standard out the testExit f.a.i.l.e.d");
System.exit(3);
- fail("Totaly impossible that this fail is ever executed. Please let me know if it is!");
+ fail("Totally impossible that this fail is ever executed. Please let me know if it is!");
} catch (ExitException e) {
if (e.getStatus() != 3) {
fail("Received wrong exit status in Exit Exception.");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
index 8dd132a..73ffff4 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
@@ -39,7 +39,7 @@ public class PolyTest {
@Test
public void testFileSet() {
buildRule.executeTarget("fileset");
- AntAssert.assertContains( "types.FileSet", buildRule.getLog());
+ AntAssert.assertContains("types.FileSet", buildRule.getLog());
}
@Test
@@ -51,16 +51,17 @@ public class PolyTest {
@Test
public void testPath() {
buildRule.executeTarget("path");
- AntAssert.assertContains( "types.Path", buildRule.getLog());
+ AntAssert.assertContains("types.Path", buildRule.getLog());
}
@Test
public void testPathAntType() {
buildRule.executeTarget("path-ant-type");
- AntAssert.assertContains( "types.PolyTest$MyPath", buildRule.getLog());
+ AntAssert.assertContains("types.PolyTest$MyPath", buildRule.getLog());
}
- public static class MyFileSet extends FileSet {}
+ public static class MyFileSet extends FileSet {
+ }
public static class MyPath extends Path {
public MyPath(Project project) {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
index f4c2abe..b7bfa5d 100644
--- a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
@@ -73,7 +73,7 @@ public class RedirectorElementTest {
@Test
public void testLogInputString() {
buildRule.executeTarget("testLogInputString");
- if (buildRule.getLog().indexOf("testLogInputString can-cat") >=0 ) {
+ if (buildRule.getLog().indexOf("testLogInputString can-cat") >= 0) {
AntAssert.assertContains("Using input string", buildRule.getFullLog());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java b/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
index b66335a..25a653d 100644
--- a/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/ResourceOutputTest.java
@@ -50,7 +50,7 @@ public class ResourceOutputTest {
public void setUp() {
project = new Project();
project.init();
- project.setUserProperty("basedir" , basedir.getAbsolutePath());
+ project.setUserProperty("basedir", basedir.getAbsolutePath());
}
@Test
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
index b30168a..efaa474 100644
--- a/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/TarFileSetTest.java
@@ -43,7 +43,7 @@ public class TarFileSetTest extends AbstractFileSetTest {
@Test
public final void testAttributes() {
- TarFileSet f = (TarFileSet)getInstance();
+ TarFileSet f = (TarFileSet) getInstance();
//check that dir and src are incompatible
f.setSrc(new File("example.tar"));
try {
@@ -54,7 +54,7 @@ public class TarFileSetTest extends AbstractFileSetTest {
} catch (BuildException be) {
assertEquals("Cannot set both dir and src attributes",be.getMessage());
}
- f = (TarFileSet)getInstance();
+ f = (TarFileSet) getInstance();
//check that dir and src are incompatible
f.setDir(new File("examples"));
try {
@@ -66,7 +66,7 @@ public class TarFileSetTest extends AbstractFileSetTest {
assertEquals("Cannot set both dir and src attributes",be.getMessage());
}
//check that fullpath and prefix are incompatible
- f = (TarFileSet)getInstance();
+ f = (TarFileSet) getInstance();
f.setSrc(new File("example.tar"));
f.setPrefix("/examples");
try {
@@ -77,7 +77,7 @@ public class TarFileSetTest extends AbstractFileSetTest {
} catch (BuildException be) {
assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
}
- f = (TarFileSet)getInstance();
+ f = (TarFileSet) getInstance();
f.setSrc(new File("example.tar"));
f.setFullpath("/doc/manual/index.html");
try {
@@ -89,7 +89,7 @@ public class TarFileSetTest extends AbstractFileSetTest {
assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
}
// check that reference tarfilesets cannot have specific attributes
- f = (TarFileSet)getInstance();
+ f = (TarFileSet) getInstance();
f.setRefid(new Reference(getProject(), "test"));
try {
f.setSrc(new File("example.tar"));
@@ -101,18 +101,22 @@ public class TarFileSetTest extends AbstractFileSetTest {
+ "attribute when using refid", be.getMessage());
}
// check that a reference tarfileset gets the same attributes as the original
- f = (TarFileSet)getInstance();
+ f = (TarFileSet) getInstance();
f.setSrc(new File("example.tar"));
f.setPrefix("/examples");
f.setFileMode("600");
f.setDirMode("530");
getProject().addReference("test",f);
- TarFileSet zid=(TarFileSet)getInstance();
+ TarFileSet zid = (TarFileSet) getInstance();
zid.setRefid(new Reference(getProject(), "test"));
- assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));
- assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
- assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));
- assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));
+ assertTrue("src attribute copied by copy constructor",
+ zid.getSrc(getProject()).equals(f.getSrc(getProject())));
+ assertTrue("prefix attribute copied by copy constructor",
+ f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
+ assertTrue("file mode attribute copied by copy constructor",
+ f.getFileMode(getProject()) == zid.getFileMode(getProject()));
+ assertTrue("dir mode attribute copied by copy constructor",
+ f.getDirMode(getProject()) == zid.getDirMode(getProject()));
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
index c1adc30..2422c79 100644
--- a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
@@ -120,7 +120,6 @@ public class XMLCatalogTest {
@Test
public void testNonExistentEntry() throws IOException, SAXException, TransformerException {
-
ResourceLocation dtd = new ResourceLocation();
dtd.setPublicId("PUBLIC ID ONE");
dtd.setLocation("i/dont/exist.dtd");
@@ -175,8 +174,8 @@ public class XMLCatalogTest {
catalog.setRefid(new Reference(project, "catalog"));
try {
- InputSource result = catalog.resolveEntity("PUBLIC ID ONE",
- "i/dont/exist.dtd");
+ @SuppressWarnings("unused")
+ InputSource result = catalog.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd");
fail("Can make XMLCatalog a Reference to itself.");
} catch (BuildException be) {
assertEquals("This data type contains a circular reference.",
@@ -198,8 +197,7 @@ public class XMLCatalogTest {
catalog1.setRefid(new Reference(project, "catalog2"));
try {
- catalog1.resolveEntity("PUBLIC ID ONE",
- "i/dont/exist.dtd");
+ catalog1.resolveEntity("PUBLIC ID ONE", "i/dont/exist.dtd");
fail("Can make circular reference");
} catch (BuildException be) {
assertEquals("This data type contains a circular reference.",
@@ -222,10 +220,7 @@ public class XMLCatalogTest {
InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
"nap:chemical+brothers");
assertNotNull(result);
- assertEquals(toURLString(dtdFile),
- result.getSystemId());
-
-
+ assertEquals(toURLString(dtdFile), result.getSystemId());
}
@Test
@@ -241,14 +236,12 @@ public class XMLCatalogTest {
InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
"nap:chemical+brothers");
assertNotNull(result);
- assertEquals(toURLString(dtdFile),
- result.getSystemId());
+ assertEquals(toURLString(dtdFile), result.getSystemId());
}
@Test
public void testEntryReference() throws IOException, SAXException, TransformerException {
-
String publicId = "-//stevo//DTD doc 1.0//EN";
String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
@@ -278,23 +271,18 @@ public class XMLCatalogTest {
catalog1.setRefid(new Reference(project, "catalog"));
catalog2.setRefid(new Reference(project, "catalog1"));
- InputSource isResult = catalog2.resolveEntity(publicId,
- "nap:chemical+brothers");
+ InputSource isResult = catalog2.resolveEntity(publicId, "nap:chemical+brothers");
assertNotNull(isResult);
- assertEquals(toURLString(dtdFile),
- isResult.getSystemId());
-
+ assertEquals(toURLString(dtdFile), isResult.getSystemId());
Source result = catalog.resolve(uri, null);
assertNotNull(result);
- assertEquals(toURLString(xmlFile),
- result.getSystemId());
+ assertEquals(toURLString(xmlFile), result.getSystemId());
}
@Test
public void testNestedCatalog() throws IOException, SAXException, TransformerException {
-
String publicId = "-//stevo//DTD doc 1.0//EN";
String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
@@ -316,22 +304,18 @@ public class XMLCatalogTest {
XMLCatalog catalog1 = newCatalog();
catalog1.addConfiguredXMLCatalog(catalog);
- InputSource isResult = catalog1.resolveEntity(publicId,
- "nap:chemical+brothers");
+ InputSource isResult = catalog1.resolveEntity(publicId, "nap:chemical+brothers");
assertNotNull(isResult);
- assertEquals(toURLString(dtdFile),
- isResult.getSystemId());
+ assertEquals(toURLString(dtdFile), isResult.getSystemId());
Source result = catalog.resolve(uri, null);
assertNotNull(result);
- assertEquals(toURLString(xmlFile),
- result.getSystemId());
+ assertEquals(toURLString(xmlFile), result.getSystemId());
}
@Test
public void testResolverBase() throws MalformedURLException, TransformerException {
-
String uri = "http://foo.com/bar/blah.xml";
String uriLoc = "etc/testcases/taskdefs/optional/xml/about.xml";
String base = toURLString(project.getBaseDir()) + "/src/";
@@ -344,15 +328,12 @@ public class XMLCatalogTest {
Source result = catalog.resolve(uri, base);
assertNotNull(result);
- assertEquals(toURLString(xmlFile),
- result.getSystemId());
+ assertEquals(toURLString(xmlFile), result.getSystemId());
}
@Test
public void testClasspath() throws IOException, TransformerException, SAXException {
-
-
String publicId = "-//stevo//DTD doc 1.0//EN";
String dtdLoc = "testcases/taskdefs/optional/xml/doc.dtd";
String path1 = project.getBaseDir().toString() + "/src/etc";
@@ -377,8 +358,7 @@ public class XMLCatalogTest {
aPath.append(new Path(project, path2));
catalog.setClasspath(aPath);
- InputSource isResult = catalog.resolveEntity(publicId,
- "nap:chemical+brothers");
+ InputSource isResult = catalog.resolveEntity(publicId, "nap:chemical+brothers");
assertNotNull(isResult);
String resultStr1 = new URL(isResult.getSystemId()).getFile();
assertTrue(toURLString(dtdFile).endsWith(resultStr1));
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java b/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
index e7b14c1..f9265fe 100644
--- a/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/ZipFileSetTest.java
@@ -30,7 +30,7 @@ import static org.junit.Assert.fail;
/**
* JUnit 3 testcases for org.apache.tools.ant.types.ZipFileSet.
*
- * <p>This doesn't actually test much, mainly reference handling.
+ * <p>This doesn't actually test much, mainly reference handling.</p>
*
*/
@@ -42,7 +42,7 @@ public class ZipFileSetTest extends AbstractFileSetTest {
@Test
public final void testAttributes() {
- ZipFileSet f = (ZipFileSet)getInstance();
+ ZipFileSet f = (ZipFileSet) getInstance();
//check that dir and src are incompatible
f.setSrc(new File("example.zip"));
try {
@@ -51,9 +51,9 @@ public class ZipFileSetTest extends AbstractFileSetTest {
+ f.getDataTypeName()
+ " when a src is already present");
} catch (BuildException be) {
- assertEquals("Cannot set both dir and src attributes",be.getMessage());
+ assertEquals("Cannot set both dir and src attributes", be.getMessage());
}
- f = (ZipFileSet)getInstance();
+ f = (ZipFileSet) getInstance();
//check that dir and src are incompatible
f.setDir(new File("examples"));
try {
@@ -62,10 +62,10 @@ public class ZipFileSetTest extends AbstractFileSetTest {
+ f.getDataTypeName()
+ " when a dir is already present");
} catch (BuildException be) {
- assertEquals("Cannot set both dir and src attributes",be.getMessage());
+ assertEquals("Cannot set both dir and src attributes", be.getMessage());
}
//check that fullpath and prefix are incompatible
- f = (ZipFileSet)getInstance();
+ f = (ZipFileSet) getInstance();
f.setSrc(new File("example.zip"));
f.setPrefix("/examples");
try {
@@ -76,7 +76,7 @@ public class ZipFileSetTest extends AbstractFileSetTest {
} catch (BuildException be) {
assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
}
- f = (ZipFileSet)getInstance();
+ f = (ZipFileSet) getInstance();
f.setSrc(new File("example.zip"));
f.setFullpath("/doc/manual/index.html");
try {
@@ -88,7 +88,7 @@ public class ZipFileSetTest extends AbstractFileSetTest {
assertEquals("Cannot set both fullpath and prefix attributes", be.getMessage());
}
// check that reference zipfilesets cannot have specific attributes
- f = (ZipFileSet)getInstance();
+ f = (ZipFileSet) getInstance();
f.setRefid(new Reference(getProject(), "test"));
try {
f.setSrc(new File("example.zip"));
@@ -100,18 +100,22 @@ public class ZipFileSetTest extends AbstractFileSetTest {
+ "attribute when using refid", be.getMessage());
}
// check that a reference zipfileset gets the same attributes as the original
- f = (ZipFileSet)getInstance();
+ f = (ZipFileSet) getInstance();
f.setSrc(new File("example.zip"));
f.setPrefix("/examples");
f.setFileMode("600");
f.setDirMode("530");
getProject().addReference("test",f);
- ZipFileSet zid=(ZipFileSet)getInstance();
+ ZipFileSet zid = (ZipFileSet) getInstance();
zid.setRefid(new Reference(getProject(), "test"));
- assertTrue("src attribute copied by copy constructor",zid.getSrc(getProject()).equals(f.getSrc(getProject())));
- assertTrue("prefix attribute copied by copy constructor",f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
- assertTrue("file mode attribute copied by copy constructor",f.getFileMode(getProject())==zid.getFileMode(getProject()));
- assertTrue("dir mode attribute copied by copy constructor",f.getDirMode(getProject())==zid.getDirMode(getProject()));
+ assertTrue("src attribute copied by copy constructor",
+ zid.getSrc(getProject()).equals(f.getSrc(getProject())));
+ assertTrue("prefix attribute copied by copy constructor",
+ f.getPrefix(getProject()).equals(zid.getPrefix(getProject())));
+ assertEquals("file mode attribute copied by copy constructor",
+ f.getFileMode(getProject()), zid.getFileMode(getProject()));
+ assertEquals("dir mode attribute copied by copy constructor",
+ f.getDirMode(getProject()), zid.getDirMode(getProject()));
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java b/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
index a982bcb..a52cabf 100644
--- a/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
+++ b/src/tests/junit/org/apache/tools/ant/types/mappers/MapperResult.java
@@ -80,7 +80,7 @@ public class MapperResult extends Task {
if (result == null) {
flattened = NULL_MAPPER_RESULT;
} else {
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
for (int i = 0; i < result.length; ++i) {
if (i != 0) {
b.append("|");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
index 10fa131..690ace6 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/FileResourceTest.java
@@ -20,7 +20,6 @@ package org.apache.tools.ant.types.resources;
import java.io.File;
import org.apache.tools.ant.Project;
-
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java
index f91077a..9e99872 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/LazyResourceCollectionTest.java
@@ -23,7 +23,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
-
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.ResourceCollection;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
index a9593f0..f848f7d 100644
--- a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java
@@ -24,6 +24,7 @@ import org.junit.Rule;
import org.junit.Test;
import java.io.File;
+import java.io.IOException;
import static org.apache.tools.ant.FileUtilities.getFileContents;
import static org.junit.Assert.assertEquals;
@@ -46,7 +47,7 @@ public class TarResourceTest {
}
@Test
- public void testUncompressSource() throws java.io.IOException {
+ public void testUncompressSource() throws IOException {
buildRule.executeTarget("uncompressSource");
assertEquals(getFileContents(buildRule.getProject().resolveFile("../../asf-logo.gif")),
getFileContents(new File(buildRule.getProject().getProperty("output"), "asf-logo.gif")));
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
index d5613b2..643dbeb 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorRule.java
@@ -20,7 +20,6 @@ package org.apache.tools.ant.types.selectors;
import java.io.File;
-
import org.apache.tools.ant.BuildFileRule;
@@ -100,21 +99,20 @@ public class BaseSelectorRule extends BuildFileRule {
* a string of "T"s amd "F"s.
*/
public String mirrorSelectionString(FileSelector selector) {
- return selectionString(mirrordir,mirrorfiles,selector);
+ return selectionString(mirrordir, mirrorfiles, selector);
}
/**
* Worker method for the two convenience methods above. Applies a
* selector on a set of files passed in and returns a string of
- * "T"s amd "F"s from applying the selector to each file.
+ * "T"s and "F"s from applying the selector to each file.
*/
public String selectionString(File basedir, File[] files, FileSelector selector) {
StringBuilder buf = new StringBuilder();
for (int x = 0; x < files.length; x++) {
- if (selector.isSelected(basedir,filenames[x],files[x])) {
+ if (selector.isSelected(basedir, filenames[x], files[x])) {
buf.append('T');
- }
- else {
+ } else {
buf.append('F');
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
index 2332778..e9c0e99 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
@@ -79,7 +79,7 @@ public abstract class BaseSelectorTest extends BuildFileTest {
*/
public BaseSelector getSelector() {
BaseSelector selector = getInstance();
- selector.setProject( getProject() );
+ selector.setProject(getProject());
return selector;
}
@@ -135,12 +135,11 @@ public abstract class BaseSelectorTest extends BuildFileTest {
* "T"s amd "F"s from applying the selector to each file.
*/
public String selectionString(File basedir, File[] files, FileSelector selector) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int x = 0; x < files.length; x++) {
- if (selector.isSelected(basedir,filenames[x],files[x])) {
+ if (selector.isSelected(basedir, filenames[x], files[x])) {
buf.append('T');
- }
- else {
+ } else {
buf.append('F');
}
}
@@ -173,13 +172,10 @@ public abstract class BaseSelectorTest extends BuildFileTest {
int length1 = expected.length();
int length2 = result.length();
int min = (length1 > length2) ? length2 : length1;
- StringBuffer sb = new StringBuffer();
- for (int i=0; i<min; i++) {
- sb.append(
- (expected.charAt(i) == result.charAt(i))
- ? "-"
- : "X"
- );
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < min; i++) {
+ sb.append((expected.charAt(i) == result.charAt(i))
+ ? "-" : "X");
}
return sb.toString();
}
@@ -193,12 +189,12 @@ public abstract class BaseSelectorTest extends BuildFileTest {
* separated with semicolons ';'
*/
public String resolve(String filelist) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int min = (filenames.length > filelist.length())
? filelist.length()
: filenames.length;
- for (int i=0; i<min; i++) {
- if ('X'==filelist.charAt(i)) {
+ for (int i = 0; i < min; i++) {
+ if ('X' == filelist.charAt(i)) {
sb.append(filenames[i]);
sb.append(";");
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
index e622be1..f1d7ca9 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
@@ -45,7 +45,8 @@ public class DateSelectorTest {
public void testValidate() {
DateSelector s = new DateSelector();
try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
fail("DateSelector did not check for required fields");
} catch (BuildException be1) {
assertEquals("You must provide a datetime or the number of "
@@ -55,7 +56,8 @@ public class DateSelectorTest {
s = new DateSelector();
s.setDatetime("01/01/1969 01:01 AM");
try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
fail("DateSelector did not check for Datetime being in the "
+ "allowable range");
} catch (BuildException be2) {
@@ -67,7 +69,8 @@ public class DateSelectorTest {
s = new DateSelector();
s.setDatetime("this is not a date");
try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
fail("DateSelector did not check for Datetime being in a "
+ "valid format");
} catch (BuildException be3) {
@@ -84,7 +87,8 @@ public class DateSelectorTest {
params[0] = param;
s.setParameters(params);
try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
fail("DateSelector did not check for valid parameter element");
} catch (BuildException be4) {
assertEquals("Invalid parameter garbage in", be4.getMessage());
@@ -97,7 +101,8 @@ public class DateSelectorTest {
params[0] = param;
s.setParameters(params);
try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
fail("DateSelector did not check for valid millis parameter");
} catch (BuildException be5) {
assertEquals("Invalid millisecond setting garbage out",
@@ -111,7 +116,8 @@ public class DateSelectorTest {
params[0] = param;
s.setParameters(params);
try {
- s.isSelected(selectorRule.getProject().getBaseDir(),selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0], selectorRule.getFiles()[0]);
fail("DateSelector did not check for valid granularity parameter");
} catch (BuildException be6) {
assertEquals("Invalid granularity setting garbage out",
@@ -204,8 +210,9 @@ public class DateSelectorTest {
// setup the modified timestamp to match what the test needs, although be aware that the 3rd and 4th
// files don't exist so can't be changed, so don't try and loop over them
- for (int i = 1; i <=2; i++) {
- Assume.assumeTrue("Cannot setup file times for test", selectorRule.getMirrorFiles()[i].setLastModified(testtime - (3*60*60*100)));
+ for (int i = 1; i <= 2; i++) {
+ Assume.assumeTrue("Cannot setup file times for test",
+ selectorRule.getMirrorFiles()[i].setLastModified(testtime - (3 * 60 * 60 * 100)));
}
@@ -218,7 +225,8 @@ public class DateSelectorTest {
s.setWhen(before);
s.setGranularity(2);
for (int i = 7; i <= 10; i++) {
- Assume.assumeTrue("Cannot setup file times for test", selectorRule.getMirrorFiles()[i].setLastModified(testtime + (3*60*60*100)));
+ Assume.assumeTrue("Cannot setup file times for test",
+ selectorRule.getMirrorFiles()[i].setLastModified(testtime + (3 * 60 * 60 * 100)));
}
results = selectorRule.mirrorSelectionString(s);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
index 526a5bf..3c7e429 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/DepthSelectorTest.java
@@ -140,8 +140,6 @@ public class DepthSelectorTest {
s.setMax(1);
results = selectorRule.selectionString(s);
assertEquals("FFFFFTTTFFFT", results);
-
-
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
index 357fe49..09483bf 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/FilenameSelectorTest.java
@@ -71,45 +71,41 @@ public class FilenameSelectorTest {
FilenameSelector s;
String results;
+ s = new FilenameSelector();
+ s.setName("no match possible");
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFFFFFFFFFF", results);
- s = new FilenameSelector();
- s.setName("no match possible");
- results = selectorRule.selectionString(s);
- assertEquals("FFFFFFFFFFFF", results);
-
- s = new FilenameSelector();
- s.setName("*.gz");
- results = selectorRule.selectionString(s);
- // This is turned off temporarily. There appears to be a bug
- // in SelectorUtils.matchPattern() where it is recursive on
- // Windows even if no ** is in pattern.
- //assertEquals("FFFTFFFFFFFF", results); // Unix
- // vs
- //assertEquals("FFFTFFFFTFFF", results); // Windows
-
- s = new FilenameSelector();
- s.setName("**/*.gz");
- s.setNegate(true);
- results = selectorRule.selectionString(s);
- assertEquals("TTTFTTTFFTTT", results);
-
- s = new FilenameSelector();
- s.setName("**/*.GZ");
- s.setCasesensitive(false);
- results = selectorRule.selectionString(s);
- assertEquals("FFFTFFFTTFFF", results);
-
- s = new FilenameSelector();
- Parameter param1 = new Parameter();
- param1.setName("name");
- param1.setValue("**/*.bz2");
- Parameter[] params = {param1};
- s.setParameters(params);
- results = selectorRule.selectionString(s);
- assertEquals("FFTFFFFFFTTF", results);
+ s = new FilenameSelector();
+ s.setName("*.gz");
+ results = selectorRule.selectionString(s);
+ // This is turned off temporarily. There appears to be a bug
+ // in SelectorUtils.matchPattern() where it is recursive on
+ // Windows even if no ** is in pattern.
+ //assertEquals("FFFTFFFFFFFF", results); // Unix
+ // vs
+ //assertEquals("FFFTFFFFTFFF", results); // Windows
+ s = new FilenameSelector();
+ s.setName("**/*.gz");
+ s.setNegate(true);
+ results = selectorRule.selectionString(s);
+ assertEquals("TTTFTTTFFTTT", results);
+ s = new FilenameSelector();
+ s.setName("**/*.GZ");
+ s.setCasesensitive(false);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFFTFFFTTFFF", results);
+ s = new FilenameSelector();
+ Parameter param1 = new Parameter();
+ param1.setName("name");
+ param1.setValue("**/*.bz2");
+ Parameter[] params = {param1};
+ s.setParameters(params);
+ results = selectorRule.selectionString(s);
+ assertEquals("FFTFFFFFFTTF", results);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java b/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
index 359a179..81e379a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/MockCache.java
@@ -47,11 +47,11 @@ public class MockCache implements Cache {
saved = true;
}
public Object get(Object key) {
- log(".get("+key+")");
+ log(".get(" + key + ")");
return key;
}
public void put(Object key, Object value) {
- log(".put("+key+", "+value+")");
+ log(".put(" + key + ", " + value + ")");
saved = false;
}
public Iterator<String> iterator() {
@@ -63,6 +63,8 @@ public class MockCache implements Cache {
}
private void log(String msg) {
- if (debug) System.out.println(this+msg);
+ if (debug) {
+ System.out.println(this + msg);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
index aa04b09..496b7ae 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
@@ -19,8 +19,8 @@
package org.apache.tools.ant.types.selectors;
-// Java
import java.io.File;
+import java.io.FileWriter;
import java.text.RuleBasedCollator;
import java.util.Comparator;
import java.util.Iterator;
@@ -168,19 +168,19 @@ public class ModifiedSelectorTest {
@Test
public void testCustomAlgorithm() {
String algo = getAlgoName("org.apache.tools.ant.types.selectors.modifiedselector.HashvalueAlgorithm");
- assertTrue("Wrong algorithm used: "+algo, algo.startsWith("HashvalueAlgorithm"));
+ assertTrue("Wrong algorithm used: " + algo, algo.startsWith("HashvalueAlgorithm"));
}
@Test
public void testCustomAlgorithm2() {
String algo = getAlgoName("org.apache.tools.ant.types.selectors.MockAlgorithm");
- assertTrue("Wrong algorithm used: "+algo, algo.startsWith("MockAlgorithm"));
+ assertTrue("Wrong algorithm used: " + algo, algo.startsWith("MockAlgorithm"));
}
@Test
public void testCustomClasses() {
- Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+ Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home"));
BFT bft = new BFT();
bft.setUp();
try {
@@ -261,13 +261,19 @@ public class ModifiedSelectorTest {
sel.isSelected(base, "file2", file2);
assertFalse("Cache must not be saved after 2nd selection.", cache.saved);
switch (kind) {
- case 1 : project.fireTaskFinished(); break;
- case 2 : project.fireTargetFinished(); break;
- case 3 : project.fireBuildFinished(); break;
+ case 1 :
+ project.fireTaskFinished();
+ break;
+ case 2 :
+ project.fireTargetFinished();
+ break;
+ case 3 :
+ project.fireBuildFinished();
+ break;
}
- assertTrue("Cache must be saved after " + kinds[kind-1] + "Finished-Event.", cache.saved);
+ assertTrue("Cache must be saved after " + kinds[kind - 1] + "Finished-Event.", cache.saved);
- // MockCache doesnt create a file - therefore no cleanup needed
+ // MockCache doesn't create a file - therefore no cleanup needed
}
@@ -291,8 +297,12 @@ public class ModifiedSelectorTest {
int posEnd = s1.indexOf(" comparator=");
String algo = s1.substring(posStart, posEnd);
// '<' and '>' are only used if the algorithm has properties
- if (algo.startsWith("<")) algo = algo.substring(1);
- if (algo.endsWith(">")) algo = algo.substring(0, algo.length()-1);
+ if (algo.startsWith("<")) {
+ algo = algo.substring(1);
+ }
+ if (algo.endsWith(">")) {
+ algo = algo.substring(0, algo.length() - 1);
+ }
// return the clean value
return algo;
}
@@ -436,10 +446,10 @@ public class ModifiedSelectorTest {
Object returned = it2.next();
boolean ok = (key1.equals(returned) || key2.equals(returned));
String msg = "Iterator returned unexpected value."
- + " key1.equals(returned)="+key1.equals(returned)
- + " key2.equals(returned)="+key2.equals(returned)
- + " returned="+returned
- + " ok="+ok;
+ + " key1.equals(returned)=" + key1.equals(returned)
+ + " key2.equals(returned)=" + key2.equals(returned)
+ + " returned=" + returned
+ + " ok=" + ok;
assertTrue(msg, ok);
// clear the cache
@@ -533,25 +543,20 @@ public class ModifiedSelectorTest {
}
-
-
// ============== testcases for the comparator implementations ==============
-
@Test
public void testEqualComparator() {
EqualComparator comp = new EqualComparator();
doTest(comp);
}
-
@Test
public void testRuleComparator() {
- RuleBasedCollator comp = (RuleBasedCollator)RuleBasedCollator.getInstance();
+ RuleBasedCollator comp = (RuleBasedCollator) RuleBasedCollator.getInstance();
doTest(comp);
}
-
@Test
public void testEqualComparatorViaSelector() {
ModifiedSelector s = new ModifiedSelector();
@@ -565,7 +570,6 @@ public class ModifiedSelectorTest {
}
}
-
@Test
@Ignore("not yet supported see note in selector")
public void testRuleComparatorViaSelector() {
@@ -580,14 +584,12 @@ public class ModifiedSelectorTest {
}
}
-
@Test
@Ignore("same logic as on algorithm, no testcases created")
public void testCustomComparator() {
// same logic as on algorithm, no testcases created
}
-
@Test
public void testResourceSelectorSimple() {
BFT bft = new BFT();
@@ -637,20 +639,18 @@ public class ModifiedSelectorTest {
assertTrue("Comparator gave wrong value.", comp.compare(o2, o3) == 0);
}
-
// ===================== scenario tests =====================
-
/**
* Tests whether the seldirs attribute is used.
*/
@Test
public void testSeldirs() {
ModifiedSelector s = new ModifiedSelector();
- StringBuffer sbTrue = new StringBuffer();
- StringBuffer sbFalse = new StringBuffer();
- for (int i=0; i<selectorRule.getFiles().length; i++) {
- if (selectorRule.getFiles()[i].isDirectory()) {
+ StringBuilder sbTrue = new StringBuilder();
+ StringBuilder sbFalse = new StringBuilder();
+ for (File file : selectorRule.getFiles()) {
+ if (file.isDirectory()) {
sbTrue.append("T");
sbFalse.append("F");
} else {
@@ -670,16 +670,15 @@ public class ModifiedSelectorTest {
s.getCache().delete();
}
-
/**
* Complex test scenario using default values (DigestAlgorithm with MD5,
* PropertiesfileCache with file=cache.properties, EqualComparator
- * and update=true). <ol>
- * <li> try fist time --> should select all </li>
- * <li> try second time --> should select no files (only directories) </li>
- * <li> modify timestamp of one file and content of a nother one </li>
- * <li> try third time --> should select only the file with modified
- * content </li>
+ * and update=true).
+ * <ol><li>try fist time --> should select all</li>
+ * <li>try second time --> should select no files (only directories)</li>
+ * <li>modify timestamp of one file and content of another one</li>
+ * <li>try third time --> should select only the file with modified
+ * content</li></ol>
*/
@Test
public void testScenario1() {
@@ -718,9 +717,9 @@ public class ModifiedSelectorTest {
// AccessObject to the test-Ant-environment
bft = new BFT();
// give some values (via property file) to that environment
- bft.writeProperties("f2name="+f2name);
- bft.writeProperties("f3name="+f3name);
- bft.writeProperties("f4name="+f4name);
+ bft.writeProperties("f2name=" + f2name);
+ bft.writeProperties("f3name=" + f3name);
+ bft.writeProperties("f4name=" + f4name);
// call the target for making the files dirty
bft.doTarget("modifiedselectortest-makeDirty");
@@ -737,13 +736,19 @@ public class ModifiedSelectorTest {
// Mark all files which should be selected as (T)rue and all others
// as (F)alse. Directories are always selected so they always are
// (T)rue.
- StringBuffer expected = new StringBuffer();
- for (int i=0; i<selectorRule.getFiles().length; i++) {
+ StringBuilder expected = new StringBuilder();
+ for (int i = 0; i < selectorRule.getFiles().length; i++) {
String ch = "F";
- if (selectorRule.getFiles()[i].isDirectory()) ch = "T";
// f2name shouldn't be selected: only timestamp has changed!
- if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) ch = "T";
- if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) ch = "T";
+ if (selectorRule.getFiles()[i].isDirectory()) {
+ ch = "T";
+ }
+ if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) {
+ ch = "T";
+ }
+ if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) {
+ ch = "T";
+ }
expected.append(ch);
}
@@ -751,35 +756,36 @@ public class ModifiedSelectorTest {
"Wrong files selected. Differing files: " // info text
+ resolve(diff(expected.toString(), results)), // list of files
expected.toString(), // expected result
- results // result
- );
-
+ results); // result
} finally {
// cleanup the environment
- if (s!=null) s.getCache().delete();
- if (bft!=null) bft.deletePropertiesfile();
+ if (s != null) {
+ s.getCache().delete();
+ }
+ if (bft != null) {
+ bft.deletePropertiesfile();
+ }
}
}
/**
* This scenario is based on scenario 1, but does not use any
- * default value and its based on <custom> selector. Used values are:<ul>
- * <li><b>Cache: </b> Propertyfile,
- * cachefile={java.io.tmpdir}/mycache.txt </li>
- * <li><b>Algorithm: </b> Digest
- * algorithm=SHA, Provider=null </li>
- * <li><b>Comparator: </b> java.text.RuleBasedCollator
- * <li><b>Update: </b> true </li>
+ * default value and its based on <custom> selector. Used values are:
+ * <ul><li><b>Cache:</b> Propertyfile,
+ * cachefile={java.io.tmpdir}/mycache.txt</li>
+ * <li><b>Algorithm:</b> Digest
+ * algorithm=SHA, Provider=null</li>
+ * <li><b>Comparator:</b> java.text.RuleBasedCollator</li>
+ * <li><b>Update:</b> true</li></ul>
*/
@Test
@Ignore("RuleBasedCollator not yet supported - see Selector:375 note")
public void testScenario2() {
ExtendSelector s = new ExtendSelector();
BFT bft = new BFT();
- String cachefile = System.getProperty("java.io.tmpdir")+"/mycache.txt";
+ String cachefile = System.getProperty("java.io.tmpdir") + "/mycache.txt";
try {
-
s.setClassname("org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector");
s.addParam(createParam("cache.cachefile", cachefile));
@@ -797,29 +803,34 @@ public class ModifiedSelectorTest {
String f2name = "tar/bz2/asf-logo-huge.tar.bz2";
String f3name = "asf-logo.gif.md5";
String f4name = "copy.filterset.filtered";
- bft.writeProperties("f2name="+f2name);
- bft.writeProperties("f3name="+f3name);
- bft.writeProperties("f4name="+f4name);
+ bft.writeProperties("f2name=" + f2name);
+ bft.writeProperties("f3name=" + f3name);
+ bft.writeProperties("f4name=" + f4name);
bft.doTarget("modifiedselectortest-makeDirty");
// third run
String results = selectorRule.selectionString(s);
- StringBuffer expected = new StringBuffer();
- for (int i=0; i<selectorRule.getFilenames().length; i++) {
+ StringBuilder expected = new StringBuilder();
+ for (int i = 0; i < selectorRule.getFilenames().length; i++) {
String ch = "F";
- if (selectorRule.getFiles()[i].isDirectory()) ch = "T";
- if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) ch = "T";
- if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) ch = "T";
+ if (selectorRule.getFiles()[i].isDirectory()) {
+ ch = "T";
+ }
+ if (selectorRule.getFilenames()[i].equalsIgnoreCase(f3name)) {
+ ch = "T";
+ }
+ if (selectorRule.getFilenames()[i].equalsIgnoreCase(f4name)) {
+ ch = "T";
+ }
expected.append(ch);
}
assertEquals(
- "Wrong files selected. Differing files: " // info text
+ "Wrong files selected. Differing files: " // info text
+ resolve(diff(expected.toString(), results)), // list of files
expected.toString(), // expected result
- results // result
- );
+ results); // result
} finally {
// cleanup the environment
- (new java.io.File(cachefile)).delete();
+ (new File(cachefile)).delete();
bft.deletePropertiesfile();
}
}
@@ -827,21 +838,21 @@ public class ModifiedSelectorTest {
@Test
public void testScenarioCoreSelectorDefaults() {
- Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+ Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home"));
doScenarioTest("modifiedselectortest-scenario-coreselector-defaults", "cache.properties");
}
@Test
public void testScenarioCoreSelectorSettings() {
- Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+ Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home"));
doScenarioTest("modifiedselectortest-scenario-coreselector-settings", "core.cache.properties");
}
@Test
public void testScenarioCustomSelectorSettings() {
- Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home") );
+ Assume.assumeNotNull("Ant home not set", selectorRule.getProject().getProperty("ant.home"));
doScenarioTest("modifiedselectortest-scenario-customselector-settings", "core.cache.properties");
}
@@ -862,9 +873,9 @@ public class ModifiedSelectorTest {
// do the checks
assertTrue("Cache file not created.", cachefile.exists());
- assertTrue("Not enough files copied on first time.", to1.list().length>5);
- assertTrue("Too much files copied on second time.", to2.list().length==0);
- assertTrue("Too much files copied on third time.", to3.list().length==2);
+ assertTrue("Not enough files copied on first time.", to1.list().length > 5);
+ assertTrue("Too much files copied on second time.", to2.list().length == 0);
+ assertTrue("Too much files copied on third time.", to3.list().length == 2);
// don't catch the JUnit exceptions
} finally {
bft.doTarget("modifiedselectortest-scenario-clean");
@@ -934,10 +945,9 @@ public class ModifiedSelectorTest {
File dir = getProject().getBaseDir();
File file = new File(dir, propfile);
try {
- java.io.FileWriter out =
- new java.io.FileWriter(file.getAbsolutePath(), true);
+ FileWriter out = new FileWriter(file.getAbsolutePath(), true);
out.write(line);
- out.write(System.getProperty("line.separator"));
+ out.write(System.lineSeparator());
out.flush();
out.close();
} catch (Exception e) {
@@ -946,7 +956,9 @@ public class ModifiedSelectorTest {
}
public void deletePropertiesfile() {
- if (!isConfigured) setUp();
+ if (!isConfigured) {
+ setUp();
+ }
new File(getProject().getBaseDir(), propfile).delete();
}
@@ -956,8 +968,7 @@ public class ModifiedSelectorTest {
cacheFile.delete();
}
- }//class-BFT
-
+ }
/**
* MockProject wrappes a very small ant project (one target, one task)
@@ -968,7 +979,7 @@ public class ModifiedSelectorTest {
private Target target;
public MockProject() {
- task = new Task(){
+ task = new Task() {
public void execute() {
}
};
@@ -983,22 +994,25 @@ public class ModifiedSelectorTest {
public void fireBuildFinished() {
super.fireBuildFinished(null);
}
+ @SuppressWarnings("unused")
public void fireSubBuildFinished() {
super.fireSubBuildFinished(null);
}
+ @SuppressWarnings("unused")
public void fireTargetStarted() {
super.fireTargetStarted(target);
}
public void fireTargetFinished() {
super.fireTargetFinished(target, null);
}
+ @SuppressWarnings("unused")
public void fireTaskStarted() {
super.fireTaskStarted(task);
}
public void fireTaskFinished() {
super.fireTaskFinished(task, null);
}
- }//class-MockProject
+ }
/**
@@ -1026,13 +1040,9 @@ public class ModifiedSelectorTest {
int length1 = expected.length();
int length2 = result.length();
int min = (length1 > length2) ? length2 : length1;
- StringBuffer sb = new StringBuffer();
- for (int i=0; i<min; i++) {
- sb.append(
- (expected.charAt(i) == result.charAt(i))
- ? "-"
- : "X"
- );
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < min; i++) {
+ sb.append((expected.charAt(i) == result.charAt(i)) ? "-" : "X");
}
return sb.toString();
}
@@ -1045,14 +1055,12 @@ public class ModifiedSelectorTest {
* separated with semicolons ';'
*/
private String resolve(String filelist) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int min = (selectorRule.getFilenames().length > filelist.length())
- ? filelist.length()
- : selectorRule.getFilenames().length;
- for (int i=0; i<min; i++) {
- if ('X'==filelist.charAt(i)) {
- sb.append(selectorRule.getFilenames()[i]);
- sb.append(";");
+ ? filelist.length() : selectorRule.getFilenames().length;
+ for (int i = 0; i < min; i++) {
+ if ('X' == filelist.charAt(i)) {
+ sb.append(selectorRule.getFilenames()[i]).append(";");
}
}
return sb.toString();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
index f273334..07b664d 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/PresentSelectorTest.java
@@ -122,7 +122,6 @@ public class PresentSelectorTest {
results = selectorRule.selectionString(s);
assertEquals("FFTFFFFFFFFF", results);
-
s = new PresentSelector();
subdir = new File(selectorRule.getOutputDir(), "selectortest2");
s.setTargetdir(subdir);
@@ -130,8 +129,6 @@ public class PresentSelectorTest {
assertEquals("TTTFFTTTTTTT", results);
results = selectorRule.selectionString(s);
assertEquals("TTTFFTTTTTTT", results);
-
-
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
index 37f41a5..23ba36f 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/SizeSelectorTest.java
@@ -130,8 +130,6 @@ public class SizeSelectorTest {
SizeSelector.SizeComparisons more = new SizeSelector.SizeComparisons();
more.setValue("more");
-
-
s = new SizeSelector();
s.setValue(10);
s.setWhen(less);
@@ -185,8 +183,6 @@ public class SizeSelectorTest {
s.setParameters(params);
results = selectorRule.selectionString(s);
assertEquals("TFFFFFFTFFTT", results);
-
-
}
@Test
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
index f775f59..1124a48 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/TypeSelectorTest.java
@@ -34,7 +34,6 @@ public class TypeSelectorTest {
@Rule
public BaseSelectorRule selectorRule = new BaseSelectorRule();
-
/**
* Test the code that validates the selector.
*/
@@ -42,11 +41,11 @@ public class TypeSelectorTest {
public void testValidate() {
TypeSelector s = new TypeSelector();
try {
- s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0] ,selectorRule.getFiles()[0]);
+ s.isSelected(selectorRule.getProject().getBaseDir(),
+ selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
fail("TypeSelector did not check for required fields");
} catch (BuildException be1) {
- assertEquals("The type attribute is required"
- , be1.getMessage());
+ assertEquals("The type attribute is required", be1.getMessage());
}
}
@@ -63,8 +62,6 @@ public class TypeSelectorTest {
TypeSelector.FileType file = new TypeSelector.FileType();
file.setValue("file");
-
-
s = new TypeSelector();
s.setType(directory);
results = selectorRule.selectionString(s);
@@ -74,8 +71,6 @@ public class TypeSelectorTest {
s.setType(file);
results = selectorRule.selectionString(s);
assertEquals("FTTTTTTTTTTF", results);
-
-
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java b/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
index fe09ce9..f9bf08b 100644
--- a/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
@@ -240,10 +240,7 @@ public class DOMElementWriterTest {
StringWriter sw = new StringWriter();
DOMElementWriter w =
- new DOMElementWriter(false,
- new DOMElementWriter.XmlNamespacePolicy(false,
- true)
- );
+ new DOMElementWriter(false, new DOMElementWriter.XmlNamespacePolicy(false, true));
w.write(root, sw, 0, " ");
assertEquals("<root ns0:bar=\"baz\" xmlns:ns0=\"urn:foo2\" />"
+ StringUtils.LINE_SEP, sw.toString());
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java
index 4f5aa84..e7edf23 100644
--- a/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/DateUtilsTest.java
@@ -32,20 +32,20 @@ public class DateUtilsTest {
@Test
- public void testElapsedTime(){
- String text = DateUtils.formatElapsedTime(50*1000);
+ public void testElapsedTime() {
+ String text = DateUtils.formatElapsedTime(50 * 1000);
assertEquals("50 seconds", text);
- text = DateUtils.formatElapsedTime(65*1000);
+ text = DateUtils.formatElapsedTime(65 * 1000);
assertEquals("1 minute 5 seconds", text);
- text = DateUtils.formatElapsedTime(120*1000);
+ text = DateUtils.formatElapsedTime(120 * 1000);
assertEquals("2 minutes 0 seconds", text);
- text = DateUtils.formatElapsedTime(121*1000);
+ text = DateUtils.formatElapsedTime(121 * 1000);
assertEquals("2 minutes 1 second", text);
}
// https://issues.apache.org/bugzilla/show_bug.cgi?id=44659
@Test
- public void testLongElapsedTime(){
+ public void testLongElapsedTime() {
assertEquals("2926 minutes 13 seconds",
DateUtils.formatElapsedTime(1000 * 175573));
assertEquals("153722867280912 minutes 55 seconds",
@@ -53,7 +53,7 @@ public class DateUtilsTest {
}
@Test
- public void testDateTimeISO(){
+ public void testDateTimeISO() {
TimeZone timeZone = TimeZone.getTimeZone("GMT+1");
Calendar cal = Calendar.getInstance(timeZone);
cal.set(2002,1,23,10,11,12);
@@ -63,7 +63,7 @@ public class DateUtilsTest {
}
@Test
- public void testDateISO(){
+ public void testDateISO() {
TimeZone timeZone = TimeZone.getTimeZone("GMT");
Calendar cal = Calendar.getInstance(timeZone);
cal.set(2002,1,23);
@@ -73,7 +73,7 @@ public class DateUtilsTest {
}
@Test
- public void testTimeISODate(){
+ public void testTimeISODate() {
// make sure that elapsed time in set via date works
TimeZone timeZone = TimeZone.getTimeZone("GMT+1");
Calendar cal = Calendar.getInstance(timeZone);
@@ -84,9 +84,9 @@ public class DateUtilsTest {
}
@Test
- public void testTimeISO(){
+ public void testTimeISO() {
// make sure that elapsed time in ms works
- long ms = (20*3600 + 11*60 + 12)*1000;
+ long ms = (20 * 3600 + 11 * 60 + 12) * 1000;
String text = DateUtils.format(ms,
DateUtils.ISO8601_TIME_PATTERN);
assertEquals("20:11:12", text);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java b/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
index bcda609..ad1f8e0 100644
--- a/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/DeweyDecimalTest.java
@@ -21,41 +21,47 @@ package org.apache.tools.ant.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
-@SuppressWarnings("ResultOfObjectAllocationIgnored")
public class DeweyDecimalTest {
@Test public void parse() {
assertEquals("1.2.3", new DeweyDecimal("1.2.3").toString());
}
- @Test(expected=NumberFormatException.class) public void misparseEmpty() {
+ @Test(expected = NumberFormatException.class)
+ public void misparseEmpty() {
new DeweyDecimal("1..2");
}
- @Test(expected=NumberFormatException.class) public void misparseNonNumeric() {
+ @Test(expected = NumberFormatException.class)
+ public void misparseNonNumeric() {
new DeweyDecimal("1.2.3-beta-5");
}
- @Test(expected=NumberFormatException.class) public void misparseFinalDot() {
+ @Test(expected = NumberFormatException.class)
+ public void misparseFinalDot() {
new DeweyDecimal("1.2.");
}
// TODO initial dots, empty string, null, negative numbers, ...
- @Test public void testHashCode() {
+ @Test
+ public void testHashCode() {
assertEquals(new DeweyDecimal("1.2.3").hashCode(), new DeweyDecimal("1.2.3").hashCode());
}
- @Test public void testEquals() {
+ @Test
+ public void testEquals() {
assertTrue(new DeweyDecimal("1.2.3").equals(new DeweyDecimal("1.2.3")));
assertFalse(new DeweyDecimal("1.2.3").equals(new DeweyDecimal("1.2.4")));
assertTrue(new DeweyDecimal("1.2.0").equals(new DeweyDecimal("1.2")));
assertTrue(new DeweyDecimal("1.2").equals(new DeweyDecimal("1.2.0")));
}
- @Test public void compareTo() {
+ @Test
+ public void compareTo() {
assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2")) > 0);
assertTrue(new DeweyDecimal("1.2").compareTo(new DeweyDecimal("1.2.3")) < 0);
assertTrue(new DeweyDecimal("1.2.3").compareTo(new DeweyDecimal("1.2.3")) == 0);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
index e016657..c520156 100644
--- a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
@@ -44,7 +44,6 @@ public class FileUtilsTest {
private File removeThis;
private String root;
-
@Before
public void setUp() {
// Windows adds the drive letter in uppercase, unless you run Cygwin
@@ -54,8 +53,7 @@ public class FileUtilsTest {
@After
public void tearDown() {
if (removeThis != null && removeThis.exists()) {
- if (!removeThis.delete())
- {
+ if (!removeThis.delete()) {
removeThis.deleteOnExit();
}
}
@@ -69,7 +67,7 @@ public class FileUtilsTest {
* behaviour and will help catch any regression in Java itself,
* so is worth retaining.
* @see FileUtils#setFileLastModified(java.io.File, long)
- * @throws IOException
+ * @throws IOException if something goes wrong
*/
@Test
public void testSetLastModified() throws IOException {
@@ -87,7 +85,7 @@ public class FileUtilsTest {
assertTrue(secondModTime > modTime);
// number of milliseconds in a day
- final int millisperday=24 * 3600 * 1000;
+ final int millisperday = 24 * 3600 * 1000;
// in a previous version, the date of the file was set to 123456
// milliseconds since 01.01.1970
// it did not work on a computer running JDK 1.4.1_02 + Windows 2000
@@ -342,8 +340,7 @@ public class FileUtilsTest {
* Test createTempFile
*/
@Test
- public void testCreateTempFile()
- {
+ public void testCreateTempFile() {
// null parent dir
File tmp1 = FILE_UTILS.createTempFile("pre", ".suf", null, false, true);
String tmploc = System.getProperty("java.io.tmpdir");
@@ -476,9 +473,7 @@ public class FileUtilsTest {
if (Os.isFamily("dos") || Os.isFamily("netware")) {
dosRoot = System.getProperty("user.dir")
.substring(0, 3).replace(File.separatorChar, '/');
- }
- else
- {
+ } else {
dosRoot = "";
}
if (Os.isFamily("dos")) {
@@ -554,13 +549,13 @@ public class FileUtilsTest {
public void testModificationTests() {
//get a time
- long firstTime=System.currentTimeMillis();
+ long firstTime = System.currentTimeMillis();
//add some time. We assume no OS has a granularity this bad
- long secondTime=firstTime+60000;
-/*
+ long secondTime = firstTime + 60000;
+ /*
assertTrue("same timestamp is up to date",
fu.isUpToDate(firstTime, firstTime));
- */
+ */
//check that older is up to date with a newer dest
assertTrue("older source files are up to date",
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
index 105c33d..7950771 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JAXPUtilsTest.java
@@ -29,9 +29,9 @@ import static org.junit.Assert.assertTrue;
public class JAXPUtilsTest {
@Test
- public void testGetSystemId(){
+ public void testGetSystemId() {
File file = null;
- if ( File.separatorChar == '\\' ){
+ if (File.separatorChar == '\\') {
file = new File("d:\\jdk");
} else {
file = new File("/user/local/bin");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
index cc786ca..6b27652 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
@@ -57,9 +57,9 @@ public class JavaEnvUtilsTest {
String j = JavaEnvUtils.getJreExecutable("java");
assertTrue(j.endsWith(".exe"));
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+ assertTrue(j + " is absolute", (new File(j)).isAbsolute());
try {
- assertTrue(j+" is normalized and in the JRE dir",
+ assertTrue(j + " is normalized and in the JRE dir",
j.startsWith(javaHome));
} catch (AssertionFailedError e) {
// java.home is bogus
@@ -69,12 +69,12 @@ public class JavaEnvUtilsTest {
j = JavaEnvUtils.getJdkExecutable("javac");
assertTrue(j.endsWith(".exe"));
try {
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+ assertTrue(j + " is absolute", (new File(j)).isAbsolute());
String javaHomeParent =
- FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
- assertTrue(j+" is normalized and in the JDK dir",
+ FILE_UTILS.normalize(javaHome + "/..").getAbsolutePath();
+ assertTrue(j + " is normalized and in the JDK dir",
j.startsWith(javaHomeParent));
- assertTrue(j+" is normalized and not in the JRE dir",
+ assertTrue(j + " is normalized and not in the JRE dir",
!j.startsWith(javaHome));
} catch (AssertionFailedError e) {
@@ -101,19 +101,19 @@ public class JavaEnvUtilsTest {
if (!extension.equals("")) {
assertTrue(j.endsWith(extension));
}
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- assertTrue(j+" is normalized and in the JRE dir",
+ assertTrue(j + " is absolute", (new File(j)).isAbsolute());
+ assertTrue(j + " is normalized and in the JRE dir",
j.startsWith(javaHome));
j = JavaEnvUtils.getJdkExecutable("javac");
if (!extension.equals("")) {
assertTrue(j.endsWith(extension));
}
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+ assertTrue(j + " is absolute", (new File(j)).isAbsolute());
String javaHomeParent =
- FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
- assertTrue(j+" is normalized and in the JDK dir",
+ FILE_UTILS.normalize(javaHome + "/..").getAbsolutePath();
+ assertTrue(j + " is normalized and in the JDK dir",
j.startsWith(javaHomeParent));
if ((Os.isFamily("mac") && JavaEnvUtils.getJavaVersionNumber() <= JavaEnvUtils.VERSION_1_6)
@@ -125,15 +125,14 @@ public class JavaEnvUtilsTest {
!j.startsWith(javaHome));
}
- assertEquals("foo"+extension,
+ assertEquals("foo" + extension,
JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo"+extension,
+ assertEquals("foo" + extension,
JavaEnvUtils.getJdkExecutable("foo"));
}
@Test
- public void testIsAtLeastJavaVersion()
- {
+ public void testIsAtLeastJavaVersion() {
assertTrue(
"Current java version is not at least the current java version...",
JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.getJavaVersion()));
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
index 89cd3da..48c52b3 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
@@ -74,7 +74,7 @@ public class LayoutPreservingPropertiesTest {
lpf.setProperty(" prop one ", " leading and trailing spaces ");
lpf.setProperty("prop\ttwo", "contains\ttab");
lpf.setProperty("prop\nthree", "contains\nnewline");
- lpf.setProperty("prop\rfour", "contains\rcarraige return");
+ lpf.setProperty("prop\rfour", "contains\rcarriage return");
lpf.setProperty("prop\ffive", "contains\fform feed");
lpf.setProperty("prop\\six", "contains\\backslash");
lpf.setProperty("prop:seven", "contains:colon");
@@ -93,7 +93,7 @@ public class LayoutPreservingPropertiesTest {
+ " spaces ") > -1);
assertTrue(s.indexOf("prop\\ttwo=contains\\ttab") > -1);
assertTrue(s.indexOf("prop\\nthree=contains\\nnewline") > -1);
- assertTrue(s.indexOf("prop\\rfour=contains\\rcarraige return") > -1);
+ assertTrue(s.indexOf("prop\\rfour=contains\\rcarriage return") > -1);
assertTrue(s.indexOf("prop\\\\six=contains\\\\backslash") > -1);
assertTrue(s.indexOf("prop\\:seven=contains\\:colon") > -1);
assertTrue(s.indexOf("prop\\=eight=contains\\=equals") > -1);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
index 1fa23e8..d4b417d 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LineOrientedOutputStreamTest.java
@@ -27,7 +27,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
public class LineOrientedOutputStreamTest {
private static String LINE = "This is a line";
@@ -61,21 +60,21 @@ public class LineOrientedOutputStreamTest {
}
@Test
- public void testLineWithCariagereturnArray() throws IOException {
+ public void testLineWithCarriageReturnArray() throws IOException {
writeByteArray();
writeAsArray('\r');
stream.assertInvoked();
}
@Test
- public void testLineWithCariagereturnSingleBytes() throws IOException {
+ public void testLineWithCarriageReturnSingleBytes() throws IOException {
writeSingleBytes();
stream.write('\r');
stream.assertInvoked();
}
@Test
- public void testLineWithCariagereturnLinefeedArray() throws IOException {
+ public void testLineWithCarriageReturnLineFeedArray() throws IOException {
writeByteArray();
writeAsArray('\r');
writeAsArray('\n');
@@ -83,7 +82,7 @@ public class LineOrientedOutputStreamTest {
}
@Test
- public void testLineWithCariagereturnLinefeedSingleBytes() throws IOException {
+ public void testLineWithCarriageReturnLineFeedSingleBytes() throws IOException {
writeSingleBytes();
stream.write('\r');
stream.write('\n');
@@ -125,9 +124,8 @@ public class LineOrientedOutputStreamTest {
}
private void writeSingleBytes() throws IOException {
- byte[] b = LINE.getBytes();
- for (int i = 0; i < b.length; i++) {
- stream.write(b[i]);
+ for (byte b : LINE.getBytes()) {
+ stream.write(b);
}
}
@@ -150,4 +148,4 @@ public class LineOrientedOutputStreamTest {
assertTrue("No output", !invoked);
}
}
-}// LineOrientedOutputStreamTest
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
index bd07251..1951a8a 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
@@ -43,6 +43,7 @@ public class ReaderInputStreamTest {
compareBytes("a", "utf-16");
}
+ @SuppressWarnings("resource")
@Test
public void testSimpleAbc16() throws Exception {
// THIS WILL FAIL.
@@ -51,7 +52,7 @@ public class ReaderInputStreamTest {
int pos = 0;
ReaderInputStream r = new ReaderInputStream(
new StringReader("abc"), "utf-16");
- for (int i = 0; true; ++i) {
+ while (true) {
int res = r.read();
if (res == -1) {
break;
@@ -63,6 +64,7 @@ public class ReaderInputStreamTest {
new String(bytes, 0, bytes.length, "utf-16");
}
+ @SuppressWarnings("resource")
@Test
public void testReadZero() throws Exception {
ReaderInputStream r = new ReaderInputStream(
@@ -88,7 +90,8 @@ public class ReaderInputStreamTest {
ReaderInputStream r = null;
FileInputStream utf8 = null;
try {
- fin = new InputStreamReader(new FileInputStream(new File(System.getProperty("root"), "src/tests/antunit/taskdefs/exec/input/iso8859-1")),
+ fin = new InputStreamReader(new FileInputStream(new File(System.getProperty("root"),
+ "src/tests/antunit/taskdefs/exec/input/iso8859-1")),
"ISO8859_1");
r = new ReaderInputStream(fin, "UTF8");
@@ -99,7 +102,8 @@ public class ReaderInputStreamTest {
b = r.read();
}
- utf8 = new FileInputStream(new File(System.getProperty("root"), "src/tests/antunit/taskdefs/exec/expected/utf-8"));
+ utf8 = new FileInputStream(new File(System.getProperty("root"),
+ "src/tests/antunit/taskdefs/exec/expected/utf-8"));
ByteArrayOutputStream expectedOS = new ByteArrayOutputStream();
b = utf8.read();
while (b > -1) {
@@ -120,9 +124,10 @@ public class ReaderInputStreamTest {
}
}
+ @SuppressWarnings("resource")
private void compareBytes(String s, String encoding) throws Exception {
byte[] expected = s.getBytes(encoding);
-
+
ReaderInputStream r = new ReaderInputStream(
new StringReader(s), encoding);
for (int i = 0; i < expected.length; ++i) {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
index 96cc9cb..50247b1 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ResourceUtilsTest.java
@@ -55,8 +55,12 @@ public class ResourceUtilsTest implements ResourceFactory, FileNameMapper {
}
/* ============ FileNameMapper interface ======================= */
- public void setFrom(String s) {}
- public void setTo(String s) {}
+ public void setFrom(String s) {
+ }
+
+ public void setTo(String s) {
+ }
+
public String[] mapFileName(String s) {
return new String[] {"fred colon", "carrot ironfoundersson"};
}
[6/6] ant git commit: Checkstyle: mostly whitespace (cf master)
Posted by gi...@apache.org.
Checkstyle: mostly whitespace (cf master)
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/572a2490
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/572a2490
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/572a2490
Branch: refs/heads/1.9.x
Commit: 572a249025f0d8df78e4373784f716751df73db0
Parents: 0ed7f4a
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Fri Dec 1 21:48:28 2017 +0100
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Fri Dec 1 21:48:28 2017 +0100
----------------------------------------------------------------------
.checkstyle | 13 ++
src/etc/checkstyle/checkstyle-config | 5 +-
.../core/containersrc/test/SpecialSeq.java | 17 +-
.../taskdefs/javadoc/java/ClassToJavadoc.java | 2 +-
.../depend/src4/test/ContainsOnlyInner.java | 3 +-
.../taskdefs/rmic/src/AntTimestamp.java | 2 +-
.../taskdefs/rmic/src/RemoteTimestamp.java | 2 +-
.../types/assertions/AssertionTest.java | 4 +-
src/etc/testcases/util/unusual.properties | 2 +-
.../org/apache/tools/ant/taskdefs/Javac.java | 2 +-
src/main/org/apache/tools/bzip2/BlockSort.java | 46 ++--
.../apache/tools/bzip2/CBZip2InputStream.java | 7 +-
.../core/uuencode/src/task/BaseTask.java | 6 +-
.../core/uuencode/src/task/UUDecodeTask.java | 1 -
.../junit/org/apache/tools/ant/AntAssert.java | 6 +-
.../tools/ant/AntClassLoaderDelegationTest.java | 17 +-
.../apache/tools/ant/AntClassLoaderTest.java | 1 +
.../org/apache/tools/ant/BuildFileRule.java | 21 +-
.../org/apache/tools/ant/BuildFileTest.java | 35 +--
.../junit/org/apache/tools/ant/CaseTest.java | 2 +-
.../org/apache/tools/ant/DefaultLoggerTest.java | 1 +
.../apache/tools/ant/DirectoryScannerTest.java | 57 +++--
.../org/apache/tools/ant/ExecutorTest.java | 24 +-
.../apache/tools/ant/ExtendedTaskdefTest.java | 4 +-
.../org/apache/tools/ant/FileUtilities.java | 5 +-
.../tools/ant/IntrospectionHelperTest.java | 52 +++--
.../org/apache/tools/ant/MockBuildListener.java | 28 ++-
.../tools/ant/ProjectHelperRepositoryTest.java | 2 +-
.../junit/org/apache/tools/ant/ProjectTest.java | 88 +++++---
.../org/apache/tools/ant/TaskContainerTest.java | 2 +-
.../apache/tools/ant/UnknownElementTest.java | 17 +-
.../tools/ant/filters/ConcatFilterTest.java | 12 +-
.../tools/ant/filters/DynamicFilterTest.java | 11 +-
.../apache/tools/ant/filters/HeadTailTest.java | 2 +-
.../tools/ant/filters/LineContainsTest.java | 3 +-
.../tools/ant/filters/TokenFilterTest.java | 8 +-
.../apache/tools/ant/launch/LocatorTest.java | 9 +-
.../taskdefs/AntLikeTasksAtTopLevelTest.java | 2 +-
.../org/apache/tools/ant/taskdefs/AntTest.java | 73 ++++--
.../apache/tools/ant/taskdefs/AntlibTest.java | 9 +-
.../tools/ant/taskdefs/AvailableTest.java | 4 +-
.../apache/tools/ant/taskdefs/BUnzip2Test.java | 10 +-
.../apache/tools/ant/taskdefs/BZip2Test.java | 4 +-
.../apache/tools/ant/taskdefs/CVSPassTest.java | 30 +--
.../apache/tools/ant/taskdefs/ChecksumTest.java | 6 +-
.../apache/tools/ant/taskdefs/ConcatTest.java | 21 +-
.../tools/ant/taskdefs/ConditionTest.java | 10 +-
.../org/apache/tools/ant/taskdefs/CopyTest.java | 44 ++--
.../apache/tools/ant/taskdefs/CopydirTest.java | 2 +-
.../tools/ant/taskdefs/DefaultExcludesTest.java | 6 +-
.../apache/tools/ant/taskdefs/DirnameTest.java | 6 +-
.../org/apache/tools/ant/taskdefs/EchoTest.java | 11 +-
.../tools/ant/taskdefs/ExecuteJavaTest.java | 36 +--
.../tools/ant/taskdefs/ExecuteWatchdogTest.java | 41 ++--
.../org/apache/tools/ant/taskdefs/FailTest.java | 28 +--
.../apache/tools/ant/taskdefs/FilterTest.java | 6 +-
.../apache/tools/ant/taskdefs/FixCrLfTest.java | 2 +-
.../apache/tools/ant/taskdefs/GUnzipTest.java | 12 +-
.../org/apache/tools/ant/taskdefs/GzipTest.java | 8 +-
.../apache/tools/ant/taskdefs/ImportTest.java | 8 +-
.../org/apache/tools/ant/taskdefs/JarTest.java | 32 +--
.../org/apache/tools/ant/taskdefs/JavaTest.java | 56 ++---
.../apache/tools/ant/taskdefs/JavacTest.java | 2 +-
.../apache/tools/ant/taskdefs/LoadFileTest.java | 25 +--
.../apache/tools/ant/taskdefs/MakeUrlTest.java | 10 +-
.../ant/taskdefs/ManifestClassPathTest.java | 5 +-
.../apache/tools/ant/taskdefs/ManifestTest.java | 30 ++-
.../apache/tools/ant/taskdefs/MkdirTest.java | 4 +-
.../org/apache/tools/ant/taskdefs/MoveTest.java | 2 +-
.../apache/tools/ant/taskdefs/MultiMapTest.java | 17 +-
.../apache/tools/ant/taskdefs/ParallelTest.java | 2 +-
.../tools/ant/taskdefs/PathConvertTest.java | 2 +-
.../apache/tools/ant/taskdefs/PropertyTest.java | 6 +-
.../ant/taskdefs/ProtectedJarMethodsTest.java | 4 +-
.../apache/tools/ant/taskdefs/RecorderTest.java | 2 +-
.../apache/tools/ant/taskdefs/ReplaceTest.java | 2 +-
.../tools/ant/taskdefs/RmicAdvancedTest.java | 30 +--
.../org/apache/tools/ant/taskdefs/RmicTest.java | 2 +-
.../apache/tools/ant/taskdefs/SQLExecTest.java | 42 ++--
.../apache/tools/ant/taskdefs/SleepTest.java | 33 ++-
.../apache/tools/ant/taskdefs/StyleTest.java | 5 +-
.../apache/tools/ant/taskdefs/SubAntTest.java | 29 ++-
.../apache/tools/ant/taskdefs/TStampTest.java | 18 +-
.../org/apache/tools/ant/taskdefs/TarTest.java | 6 +-
.../apache/tools/ant/taskdefs/TestProcess.java | 38 +---
.../apache/tools/ant/taskdefs/TouchTest.java | 20 +-
.../tools/ant/taskdefs/TypeAdapterTest.java | 11 +-
.../apache/tools/ant/taskdefs/TypedefTest.java | 6 +-
.../apache/tools/ant/taskdefs/UntarTest.java | 17 +-
.../apache/tools/ant/taskdefs/UnzipTest.java | 10 +-
.../apache/tools/ant/taskdefs/UpToDateTest.java | 2 +-
.../tools/ant/taskdefs/XmlPropertyTest.java | 51 ++---
.../tools/ant/taskdefs/ZipExtraFieldTest.java | 11 +-
.../org/apache/tools/ant/taskdefs/ZipTest.java | 6 +-
.../compilers/DefaultCompilerAdapterTest.java | 13 +-
.../ant/taskdefs/condition/IsReachableTest.java | 8 +-
.../taskdefs/condition/ParserSupportsTest.java | 2 +-
.../taskdefs/cvslib/ChangeLogParserTest.java | 2 +-
.../taskdefs/cvslib/ChangeLogWriterTest.java | 21 +-
.../org/apache/tools/ant/taskdefs/dir2/A.java | 4 +-
.../ant/taskdefs/email/EmailAddressTest.java | 36 +--
.../tools/ant/taskdefs/optional/ANTLRTest.java | 4 +-
.../optional/AbstractXSLTLiaisonTest.java | 6 +-
.../taskdefs/optional/EchoPropertiesTest.java | 57 +++--
.../tools/ant/taskdefs/optional/JspcTest.java | 30 +--
.../ant/taskdefs/optional/Native2AsciiTest.java | 3 +-
.../ant/taskdefs/optional/PropertyFileTest.java | 3 +-
.../taskdefs/optional/ReplaceRegExpTest.java | 4 +-
.../ant/taskdefs/optional/TraXLiaisonTest.java | 20 +-
.../taskdefs/optional/depend/DependTest.java | 24 +-
.../taskdefs/optional/i18n/TranslateTest.java | 13 +-
.../ant/taskdefs/optional/image/ImageTest.java | 6 +-
.../taskdefs/optional/jdepend/JDependTest.java | 2 +-
.../taskdefs/optional/junit/BatchTestTest.java | 3 +-
.../taskdefs/optional/junit/DOMUtilTest.java | 5 +-
.../optional/junit/JUnitClassLoaderTest.java | 2 +-
.../optional/junit/JUnitReportTest.java | 25 ++-
.../taskdefs/optional/junit/JUnitTaskTest.java | 99 +++++---
.../optional/junit/JUnitTestListenerTest.java | 2 +-
.../optional/junit/JUnitTestRunnerTest.java | 98 ++++----
.../optional/junit/JUnitVersionHelperTest.java | 32 ++-
.../ant/taskdefs/optional/junit/Sleeper.java | 1 -
.../optional/junit/XMLResultAggregatorTest.java | 12 +-
.../ant/taskdefs/optional/net/FTPTest.java | 225 +++++++------------
.../ant/taskdefs/optional/sos/SOSTest.java | 2 +-
.../ant/taskdefs/optional/ssh/ScpTest.java | 122 +++++-----
.../ant/taskdefs/optional/unix/SymlinkTest.java | 8 +-
.../ant/taskdefs/optional/vss/MSVSSTest.java | 13 +-
.../org/apache/tools/ant/types/AddTypeTest.java | 53 +++--
.../apache/tools/ant/types/AssertionsTest.java | 4 +-
.../tools/ant/types/CommandlineJavaTest.java | 2 +-
.../apache/tools/ant/types/CommandlineTest.java | 4 +-
.../apache/tools/ant/types/DescriptionTest.java | 12 +-
.../ant/types/EnumeratedAttributeTest.java | 16 +-
.../apache/tools/ant/types/FilterSetTest.java | 7 +-
.../org/apache/tools/ant/types/PathTest.java | 4 +-
.../apache/tools/ant/types/PermissionsTest.java | 8 +-
.../org/apache/tools/ant/types/PolyTest.java | 9 +-
.../tools/ant/types/RedirectorElementTest.java | 2 +-
.../tools/ant/types/ResourceOutputTest.java | 2 +-
.../apache/tools/ant/types/TarFileSetTest.java | 26 ++-
.../apache/tools/ant/types/XMLCatalogTest.java | 46 ++--
.../apache/tools/ant/types/ZipFileSetTest.java | 32 +--
.../tools/ant/types/mappers/MapperResult.java | 2 +-
.../ant/types/resources/FileResourceTest.java | 1 -
.../resources/LazyResourceCollectionTest.java | 1 -
.../ant/types/resources/TarResourceTest.java | 3 +-
.../ant/types/selectors/BaseSelectorRule.java | 10 +-
.../ant/types/selectors/BaseSelectorTest.java | 26 +--
.../ant/types/selectors/DateSelectorTest.java | 26 ++-
.../ant/types/selectors/DepthSelectorTest.java | 2 -
.../types/selectors/FilenameSelectorTest.java | 66 +++---
.../tools/ant/types/selectors/MockCache.java | 8 +-
.../types/selectors/ModifiedSelectorTest.java | 206 +++++++++--------
.../types/selectors/PresentSelectorTest.java | 3 -
.../ant/types/selectors/SizeSelectorTest.java | 4 -
.../ant/types/selectors/TypeSelectorTest.java | 11 +-
.../tools/ant/util/DOMElementWriterTest.java | 5 +-
.../apache/tools/ant/util/DateUtilsTest.java | 22 +-
.../apache/tools/ant/util/DeweyDecimalTest.java | 20 +-
.../apache/tools/ant/util/FileUtilsTest.java | 23 +-
.../apache/tools/ant/util/JAXPUtilsTest.java | 4 +-
.../apache/tools/ant/util/JavaEnvUtilsTest.java | 29 ++-
.../util/LayoutPreservingPropertiesTest.java | 4 +-
.../ant/util/LineOrientedOutputStreamTest.java | 16 +-
.../tools/ant/util/ReaderInputStreamTest.java | 13 +-
.../tools/ant/util/ResourceUtilsTest.java | 8 +-
.../apache/tools/ant/util/StringUtilsTest.java | 26 ++-
.../tools/ant/util/UnPackageNameMapperTest.java | 2 +-
.../util/regexp/JakartaRegexpMatcherTest.java | 3 +-
.../util/regexp/JakartaRegexpRegexpTest.java | 7 +-
.../ant/util/regexp/Jdk14RegexpMatcherTest.java | 8 +-
.../ant/util/regexp/Jdk14RegexpRegexpTest.java | 8 +-
.../ant/util/regexp/RegexpMatcherTest.java | 6 +-
.../apache/tools/bzip2/CBZip2StreamTest.java | 1 +
.../org/apache/tools/mail/MailMessageTest.java | 111 +++++----
.../org/apache/tools/tar/TarEntryTest.java | 4 +-
.../org/apache/tools/zip/AsiExtraFieldTest.java | 8 +-
.../apache/tools/zip/ExtraFieldUtilsTest.java | 26 +--
.../org/apache/tools/zip/UTF8ZipFilesTest.java | 12 +-
.../org/apache/tools/zip/ZipEncodingTest.java | 6 +-
.../org/apache/tools/zip/ZipEntryTest.java | 2 +-
.../junit/org/apache/tools/zip/ZipLongTest.java | 2 +-
.../org/example/junit/MultilineAsserts.java | 16 +-
.../junit/org/example/junit/TestNotMissed.java | 1 -
.../example/tasks/TaskdefTestContainerTask.java | 3 +-
.../example/tasks/TaskdefTestSimpleTask.java | 15 +-
187 files changed, 1714 insertions(+), 1636 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/.checkstyle
----------------------------------------------------------------------
diff --git a/.checkstyle b/.checkstyle
new file mode 100644
index 0000000..f2697b1
--- /dev/null
+++ b/.checkstyle
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <local-check-config name="Ant Checkstyle Config" location="src/etc/checkstyle/checkstyle-config" type="project" description="">
+ <property name="config.dir" value="${basedir}/src/etc/checkstyle"/>
+ <additional-data name="protect-config-file" value="true"/>
+ </local-check-config>
+ <fileset name="Ant Checkstyle config" enabled="true" check-config-name="Ant Checkstyle Config" local="true">
+ <file-match-pattern match-pattern="^src.main.*.java$" include-pattern="true"/>
+ <file-match-pattern match-pattern="^src.etc.testcases.*.java$" include-pattern="true"/>
+ <file-match-pattern match-pattern="^src.tests.*.java$" include-pattern="true"/>
+ </fileset>
+</fileset-config>
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/checkstyle/checkstyle-config
----------------------------------------------------------------------
diff --git a/src/etc/checkstyle/checkstyle-config b/src/etc/checkstyle/checkstyle-config
index b3232be..508a882 100644
--- a/src/etc/checkstyle/checkstyle-config
+++ b/src/etc/checkstyle/checkstyle-config
@@ -1,4 +1,5 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
<module name="Checker">
@@ -65,6 +65,7 @@
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
+ <property name="tabWidth" value="4"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/core/containersrc/test/SpecialSeq.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/core/containersrc/test/SpecialSeq.java b/src/etc/testcases/core/containersrc/test/SpecialSeq.java
index ae6a3dd..f3f0176 100644
--- a/src/etc/testcases/core/containersrc/test/SpecialSeq.java
+++ b/src/etc/testcases/core/containersrc/test/SpecialSeq.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
package test;
@@ -22,21 +22,22 @@ import org.apache.tools.ant.TaskContainer;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.taskdefs.Echo;
-import java.util.*;
+
+import java.util.Enumeration;
+import java.util.Vector;
public class SpecialSeq extends Task implements TaskContainer {
/** Optional Vector holding the nested tasks */
private Vector nestedTasks = new Vector();
private FileSet fileset;
-
+
private Echo nestedEcho;
-
+
/**
* Add a nested task.
- * <p>
+ *
* @param nestedTask Nested task to execute
- * <p>
*/
public void addTask(Task nestedTask) {
nestedTasks.addElement(nestedTask);
@@ -60,7 +61,7 @@ public class SpecialSeq extends Task implements TaskContainer {
public void addFileset(FileSet fileset) {
this.fileset = fileset;
}
-
+
public void addNested(Echo nestedEcho) {
this.nestedEcho = nestedEcho;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java b/src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java
index a41bdc1..bd8cab6 100644
--- a/src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java
+++ b/src/etc/testcases/taskdefs/javadoc/java/ClassToJavadoc.java
@@ -31,7 +31,7 @@ public class ClassToJavadoc {
* @see java.lang.Object#toString()
*/
public String toString() { return this.getClass().getName(); }
-
+
/**
* @return An arbitrary string.
*/
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/taskdefs/optional/depend/src4/test/ContainsOnlyInner.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/optional/depend/src4/test/ContainsOnlyInner.java b/src/etc/testcases/taskdefs/optional/depend/src4/test/ContainsOnlyInner.java
index d00254b..9694ddd 100644
--- a/src/etc/testcases/taskdefs/optional/depend/src4/test/ContainsOnlyInner.java
+++ b/src/etc/testcases/taskdefs/optional/depend/src4/test/ContainsOnlyInner.java
@@ -19,6 +19,5 @@ package test;
public class ContainsOnlyInner {
void method1() {
System.out.println(Outer.Inner.class);
- }
+ }
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/taskdefs/rmic/src/AntTimestamp.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/rmic/src/AntTimestamp.java b/src/etc/testcases/taskdefs/rmic/src/AntTimestamp.java
index d9ba785..579d2ed 100644
--- a/src/etc/testcases/taskdefs/rmic/src/AntTimestamp.java
+++ b/src/etc/testcases/taskdefs/rmic/src/AntTimestamp.java
@@ -39,7 +39,7 @@ public class AntTimestamp implements RemoteTimestamp {
* @throws RemoteException
*/
public long when() throws RemoteException {
- Calendar cal=Calendar.getInstance();
+ Calendar cal = Calendar.getInstance();
return DateUtils.getPhaseOfMoon(cal);
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/taskdefs/rmic/src/RemoteTimestamp.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/rmic/src/RemoteTimestamp.java b/src/etc/testcases/taskdefs/rmic/src/RemoteTimestamp.java
index 1834e4a..5c9afc8 100644
--- a/src/etc/testcases/taskdefs/rmic/src/RemoteTimestamp.java
+++ b/src/etc/testcases/taskdefs/rmic/src/RemoteTimestamp.java
@@ -21,6 +21,6 @@ import java.rmi.RemoteException;
* this is the interface we remote
*/
public interface RemoteTimestamp extends Remote {
- long when() throws RemoteException ;
+ long when() throws RemoteException;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/types/assertions/AssertionTest.java
----------------------------------------------------------------------
diff --git a/src/etc/testcases/types/assertions/AssertionTest.java b/src/etc/testcases/types/assertions/AssertionTest.java
index 28a9dc3..d717203 100644
--- a/src/etc/testcases/types/assertions/AssertionTest.java
+++ b/src/etc/testcases/types/assertions/AssertionTest.java
@@ -31,14 +31,14 @@ public class AssertionTest extends TestCase {
try {
assert true == false;
fail("expected an assertion");
- } catch(AssertionError asserto) {
+ } catch (AssertionError asserto) {
//if we got here, all was well
}
}
public void testAssertNotRaised() {
- assert(2+2==4);
+ assert(2 + 2 == 4);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/etc/testcases/util/unusual.properties
----------------------------------------------------------------------
diff --git a/src/etc/testcases/util/unusual.properties b/src/etc/testcases/util/unusual.properties
index 9c370fa..3b63de6 100644
--- a/src/etc/testcases/util/unusual.properties
+++ b/src/etc/testcases/util/unusual.properties
@@ -19,7 +19,7 @@ prop\ttwo=contains\ttab
prop\nthree=contains\nnewline
-prop\rfour=contains\rcarraige return
+prop\rfour=contains\rcarriage return
prop\ffive=contains\fform feed
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/main/org/apache/tools/ant/taskdefs/Javac.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java
index 23c19dd..d0af0a3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javac.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java
@@ -1181,7 +1181,7 @@ public class Javac extends MatchingTask {
scanDir(srcDir, destDir != null ? destDir : srcDir, files);
}
}
-
+
private void collectFileListFromModulePath() {
final FileUtils fu = FileUtils.getFileUtils();
for (String pathElement : moduleSourcepath.list()) {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/main/org/apache/tools/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/BlockSort.java b/src/main/org/apache/tools/bzip2/BlockSort.java
index 073b223..46c6a5c 100644
--- a/src/main/org/apache/tools/bzip2/BlockSort.java
+++ b/src/main/org/apache/tools/bzip2/BlockSort.java
@@ -36,7 +36,7 @@ import java.util.BitSet;
* <pre>
* CompressCommons
* Commons Compress
- * CompressCommons
+ * CompressCommons
* essCommons Compr
* mmons CompressCo
* mons CompressCom
@@ -251,7 +251,7 @@ class BlockSort {
* bucket 'ra' with sort index 5. The fully sorted order then becomes.
*
* fmap = { 5, 3, 0, 4, 1, 2 }
- *
+ *
*/
/**
@@ -261,12 +261,12 @@ class BlockSort {
* @param eclass points from the index of a character inside the
* block to the first index in fmap that contains the
* bucket of its suffix that is sorted in this step.
- * @param lo lower boundary of the fmap-interval to be sorted
- * @param hi upper boundary of the fmap-interval to be sorted
+ * @param lo lower boundary of the fmap-interval to be sorted
+ * @param hi upper boundary of the fmap-interval to be sorted
*/
- private void fallbackSimpleSort(int[] fmap,
- int[] eclass,
- int lo,
+ private void fallbackSimpleSort(int[] fmap,
+ int[] eclass,
+ int lo,
int hi) {
if (lo == hi) {
return;
@@ -336,12 +336,12 @@ class BlockSort {
* @param eclass points from the index of a character inside the
* block to the first index in fmap that contains the
* bucket of its suffix that is sorted in this step.
- * @param loSt lower boundary of the fmap-interval to be sorted
- * @param hiSt upper boundary of the fmap-interval to be sorted
+ * @param loSt lower boundary of the fmap-interval to be sorted
+ * @param hiSt upper boundary of the fmap-interval to be sorted
*/
- private void fallbackQSort3(int[] fmap,
- int[] eclass,
- int loSt,
+ private void fallbackQSort3(int[] fmap,
+ int[] eclass,
+ int loSt,
int hiSt) {
int lo, unLo, ltLo, hi, unHi, gtHi, n;
@@ -359,16 +359,16 @@ class BlockSort {
}
/* LBZ2: Random partitioning. Median of 3 sometimes fails to
- avoid bad cases. Median of 9 seems to help but
+ avoid bad cases. Median of 9 seems to help but
looks rather expensive. This too seems to work but
- is cheaper. Guidance for the magic constants
+ is cheaper. Guidance for the magic constants
7621 and 32768 is taken from Sedgewick's algorithms
book, chapter 35.
*/
r = ((r * 7621) + 1) % 32768;
long r3 = r % 3, med;
if (r3 == 0) {
- med = eclass[fmap[lo]];
+ med = eclass[fmap[lo]];
} else if (r3 == 1) {
med = eclass[fmap[(lo + hi) >>> 1]];
} else {
@@ -386,10 +386,10 @@ class BlockSort {
break;
}
n = eclass[fmap[unLo]] - (int) med;
- if (n == 0) {
- fswap(fmap, unLo, ltLo);
- ltLo++; unLo++;
- continue;
+ if (n == 0) {
+ fswap(fmap, unLo, ltLo);
+ ltLo++; unLo++;
+ continue;
}
if (n > 0) {
break;
@@ -402,9 +402,9 @@ class BlockSort {
}
n = eclass[fmap[unHi]] - (int) med;
if (n == 0) {
- fswap(fmap, unHi, gtHi);
- gtHi--; unHi--;
- continue;
+ fswap(fmap, unHi, gtHi);
+ gtHi--; unHi--;
+ continue;
}
if (n < 0) {
break;
@@ -510,7 +510,7 @@ class BlockSort {
--*/
/*-- LBZ2: set sentinel bits for block-end detection --*/
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < 32; i++) {
bhtab.set(nblock + 2 * i);
bhtab.clear(nblock + 2 * i + 1);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/CBZip2InputStream.java b/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
index 62315d1..73b6aa1 100644
--- a/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
+++ b/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
@@ -40,7 +40,7 @@ import java.io.InputStream;
* source stream via the single byte {@link java.io.InputStream#read()
* read()} method exclusively. Thus you should consider to use a
* buffered source stream.</p>
- *
+ *
* <p>Instances of this class are not threadsafe.</p>
*/
public class CBZip2InputStream extends InputStream implements BZip2Constants {
@@ -173,7 +173,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
/*
* (non-Javadoc)
- *
+ *
* @see java.io.InputStream#read(byte[], int, int)
*/
@Override
@@ -261,7 +261,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
if (null == in) {
throw new IOException("No InputStream");
}
-
+
if (isFirstStream) {
if (in.available() == 0) {
throw new IOException("Empty InputStream");
@@ -1059,4 +1059,3 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/antunit/core/uuencode/src/task/BaseTask.java
----------------------------------------------------------------------
diff --git a/src/tests/antunit/core/uuencode/src/task/BaseTask.java b/src/tests/antunit/core/uuencode/src/task/BaseTask.java
index 22fb70e..320f753 100644
--- a/src/tests/antunit/core/uuencode/src/task/BaseTask.java
+++ b/src/tests/antunit/core/uuencode/src/task/BaseTask.java
@@ -63,10 +63,10 @@ abstract public class BaseTask extends Task {
FILE_UTILS.close(outputStream);
}
}
-
+
abstract protected void doit(
InputStream is, OutputStream os) throws Exception;
-
+
private void assertAttribute(File file, String attributeName) {
if (file == null) {
throw new BuildException("Required attribute " + attributeName
@@ -74,5 +74,3 @@ abstract public class BaseTask extends Task {
}
}
}
-
-
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/antunit/core/uuencode/src/task/UUDecodeTask.java
----------------------------------------------------------------------
diff --git a/src/tests/antunit/core/uuencode/src/task/UUDecodeTask.java b/src/tests/antunit/core/uuencode/src/task/UUDecodeTask.java
index 8423f8c..d74b846 100644
--- a/src/tests/antunit/core/uuencode/src/task/UUDecodeTask.java
+++ b/src/tests/antunit/core/uuencode/src/task/UUDecodeTask.java
@@ -28,4 +28,3 @@ public class UUDecodeTask extends BaseTask {
new UUDecoder().decodeBuffer(is, os);
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/AntAssert.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/AntAssert.java b/src/tests/junit/org/apache/tools/ant/AntAssert.java
index 5bc3caa..d23792e 100644
--- a/src/tests/junit/org/apache/tools/ant/AntAssert.java
+++ b/src/tests/junit/org/apache/tools/ant/AntAssert.java
@@ -34,7 +34,8 @@ public class AntAssert {
*/
public static void assertContains(String message, String needle, String haystack) {
String formattedMessage = (message == null ? "" : message + " ");
- assertTrue(formattedMessage + String.format("expected message containing: <%s> but got: <%s>", needle, haystack), haystack.contains(needle));
+ assertTrue(formattedMessage + String.format("expected message containing: <%s> but got: <%s>",
+ needle, haystack), haystack.contains(needle));
}
/**
@@ -55,7 +56,8 @@ public class AntAssert {
*/
public static void assertNotContains(String message, String needle, String haystack) {
String formattedMessage = (message == null ? "" : message + " ");
- assertFalse(formattedMessage + String.format("expected message not to contain: <%s> but got: <%s>", needle, haystack), haystack.contains(needle));
+ assertFalse(formattedMessage + String.format("expected message not to contain: <%s> but got: <%s>",
+ needle, haystack), haystack.contains(needle));
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java b/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java
index ae5ce62..b6f5b5f 100644
--- a/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java
+++ b/src/tests/junit/org/apache/tools/ant/AntClassLoaderDelegationTest.java
@@ -55,6 +55,7 @@ public class AntClassLoaderDelegationTest {
private static final String TEST_RESOURCE
= "apache/tools/ant/IncludeTest.class";
+ @SuppressWarnings("resource")
@Test
public void testFindResources() throws Exception {
// This path should contain the class files for these testcases:
@@ -81,6 +82,7 @@ public class AntClassLoaderDelegationTest {
enum2List(acl.getResources(TEST_RESOURCE)));
}
+ @SuppressWarnings("resource")
@Test
public void testFindIsolateResources() throws Exception {
String buildTestcases = System.getProperty("build.tests");
@@ -99,16 +101,17 @@ public class AntClassLoaderDelegationTest {
Arrays.asList(new URL[] {urlFromPath}),
enum2List(acl.getResources(TEST_RESOURCE)));
}
-
+
private static List enum2List(Enumeration e) {
return Collections.list(e);
}
-
+
/** Special loader that just knows how to find TEST_RESOURCE. */
private static final class ParentLoader extends ClassLoader {
-
- public ParentLoader() {}
-
+
+ public ParentLoader() {
+ }
+
protected Enumeration findResources(String name) throws IOException {
if (name.equals(TEST_RESOURCE)) {
return Collections.enumeration(
@@ -118,7 +121,7 @@ public class AntClassLoaderDelegationTest {
return Collections.enumeration(Collections.EMPTY_SET);
}
}
-
+
}
-
+
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
index 17c418a..bddf729 100644
--- a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
+++ b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
@@ -207,6 +207,7 @@ public class AntClassLoaderTest {
* @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=46752">
* https://issues.apache.org/bugzilla/show_bug.cgi?id=46752</a>
*/
+ @SuppressWarnings("resource")
@Test
public void testGetResources() throws IOException {
AntClassLoader acl = new AntClassLoader(new EmptyLoader(), null,
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
index 05f7d8e..52ec877 100644
--- a/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
+++ b/src/tests/junit/org/apache/tools/ant/BuildFileRule.java
@@ -28,8 +28,8 @@ import org.junit.rules.ExternalResource;
/**
* Provides access for JUnit tests to execute Ant targets and access execution details (i.e logs).
*
- * Example usage:
- * <code>
+ * <p>Example usage:</p>
+ * <pre>
* public class MyTest {
*
* \@Rule
@@ -42,7 +42,7 @@ import org.junit.rules.ExternalResource;
*
* \@Test
* public void testSuccess() {
- * rule.executeTarget("passingTaget");
+ * rule.executeTarget("passingTarget");
* assertEquals("Incorrect log message", "[taskName] Action Complete", rule.getLog());
* }
*
@@ -57,7 +57,7 @@ import org.junit.rules.ExternalResource;
* }
*
* }
- * </code>
+ * </pre>
*/
public class BuildFileRule extends ExternalResource {
@@ -102,8 +102,7 @@ public class BuildFileRule extends ExternalResource {
/**
* Gets any messages that have been logged during the current execution, unless
* the logging level has been set above the log level defined in the message.
- *
- * Only valid if configureProject() has been called.
+ * <p>Only valid if configureProject() has been called.</p>
* @return the content of the log.
*/
public String getFullLog() {
@@ -159,7 +158,7 @@ public class BuildFileRule extends ExternalResource {
File antFile = new File(System.getProperty("root"), filename);
project.setProperty("ant.processid", ProcessUtil.getProcessId("<Process>"));
project.setProperty("ant.threadname", Thread.currentThread().getName());
- project.setUserProperty("ant.file" , antFile.getAbsolutePath());
+ project.setUserProperty("ant.file", antFile.getAbsolutePath());
project.addBuildListener(new AntTestListener(logLevel));
ProjectHelper.configureProject(project, antFile);
}
@@ -217,7 +216,7 @@ public class BuildFileRule extends ExternalResource {
protected static class AntOutputStream extends OutputStream {
private StringBuffer buffer;
- public AntOutputStream( StringBuffer buffer ) {
+ public AntOutputStream(StringBuffer buffer) {
this.buffer = buffer;
}
@@ -301,9 +300,9 @@ public class BuildFileRule extends ExternalResource {
return;
}
- if (event.getPriority() == Project.MSG_INFO ||
- event.getPriority() == Project.MSG_WARN ||
- event.getPriority() == Project.MSG_ERR) {
+ if (event.getPriority() == Project.MSG_INFO
+ || event.getPriority() == Project.MSG_WARN
+ || event.getPriority() == Project.MSG_ERR) {
logBuffer.append(event.getMessage());
}
fullLogBuffer.append(event.getMessage());
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
index e18d71b..02b49e3 100644
--- a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
+++ b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
@@ -19,6 +19,7 @@
package org.apache.tools.ant;
import java.io.File;
+import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URL;
@@ -139,28 +140,28 @@ public abstract class BuildFileTest extends TestCase {
/**
* Assert that the given substring is in the output messages.
- * @param message Print this message if the test fails. Defaults to
- * a meaningful text if <tt>null</tt> is passed.
+ * @param message Print this message if the test fails. Defaults to
+ * a meaningful text if <tt>null</tt> is passed.
* @since Ant1.7
*/
public void assertOutputContaining(String message, String substring) {
String realOutput = getOutput();
- String realMessage = (message != null)
- ? message
+ String realMessage = (message != null)
+ ? message
: "expecting output to contain \"" + substring + "\" output was \"" + realOutput + "\"";
assertTrue(realMessage, realOutput.indexOf(substring) >= 0);
}
/**
* Assert that the given substring is not in the output messages.
- * @param message Print this message if the test fails. Defaults to
- * a meaningful text if <tt>null</tt> is passed.
+ * @param message Print this message if the test fails. Defaults to
+ * a meaningful text if <tt>null</tt> is passed.
* @since Ant1.7
*/
public void assertOutputNotContaining(String message, String substring) {
String realOutput = getOutput();
- String realMessage = (message != null)
- ? message
+ String realMessage = (message != null)
+ ? message
: "expecting output to not contain \"" + substring + "\" output was \"" + realOutput + "\"";
assertFalse(realMessage, realOutput.indexOf(substring) >= 0);
}
@@ -209,7 +210,7 @@ public abstract class BuildFileTest extends TestCase {
*/
public void assertDebuglogContaining(String substring) {
String realLog = getFullLog();
- assertTrue("expecting debug log to contain \"" + substring
+ assertTrue("expecting debug log to contain \"" + substring
+ "\" log was \""
+ realLog + "\"",
realLog.indexOf(substring) >= 0);
@@ -268,7 +269,7 @@ public abstract class BuildFileTest extends TestCase {
}
private String cleanBuffer(StringBuffer buffer) {
- StringBuffer cleanedBuffer = new StringBuffer();
+ StringBuilder cleanedBuffer = new StringBuilder();
for (int i = 0; i < buffer.length(); i++) {
char ch = buffer.charAt(i);
if (ch != '\r') {
@@ -299,7 +300,7 @@ public abstract class BuildFileTest extends TestCase {
project = new Project();
project.init();
File antFile = new File(System.getProperty("root"), filename);
- project.setUserProperty("ant.file" , antFile.getAbsolutePath());
+ project.setUserProperty("ant.file", antFile.getAbsolutePath());
// set two new properties to allow to build unique names when running multithreaded tests
project.setProperty("ant.processid", ProcessUtil.getProcessId("<Process>"));
project.setProperty("ant.threadname", Thread.currentThread().getName());
@@ -480,7 +481,7 @@ public abstract class BuildFileTest extends TestCase {
* @param resource the resource to retrieve its url.
* @throws junit.framework.AssertionFailedError if the resource is not found.
*/
- public URL getResource(String resource){
+ public URL getResource(String resource) {
URL url = getClass().getResource(resource);
assertNotNull("Could not find resource :" + resource, url);
return url;
@@ -489,10 +490,10 @@ public abstract class BuildFileTest extends TestCase {
/**
* an output stream which saves stuff to our buffer.
*/
- protected static class AntOutputStream extends java.io.OutputStream {
+ protected static class AntOutputStream extends OutputStream {
private StringBuffer buffer;
- public AntOutputStream( StringBuffer buffer ) {
+ public AntOutputStream(StringBuffer buffer) {
this.buffer = buffer;
}
@@ -580,9 +581,9 @@ public abstract class BuildFileTest extends TestCase {
return;
}
- if (event.getPriority() == Project.MSG_INFO ||
- event.getPriority() == Project.MSG_WARN ||
- event.getPriority() == Project.MSG_ERR) {
+ if (event.getPriority() == Project.MSG_INFO
+ || event.getPriority() == Project.MSG_WARN
+ || event.getPriority() == Project.MSG_ERR) {
logBuffer.append(event.getMessage());
}
fullLogBuffer.append(event.getMessage());
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/CaseTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/CaseTest.java b/src/tests/junit/org/apache/tools/ant/CaseTest.java
index 04f60be..a466ea4 100644
--- a/src/tests/junit/org/apache/tools/ant/CaseTest.java
+++ b/src/tests/junit/org/apache/tools/ant/CaseTest.java
@@ -56,7 +56,7 @@ public class CaseTest {
try {
buildRule.executeTarget("taskcase");
fail("Build exception should have been thrown due to case sensitivity of name");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertContains("Task names should be case sensitive", "Problem: failed to create task or type ecHO", ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java b/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java
index 00f4dfa..303a44b 100644
--- a/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/DefaultLoggerTest.java
@@ -34,6 +34,7 @@ public class DefaultLoggerTest {
return m.toString();
}
+ @SuppressWarnings("serial")
@Test
public void testThrowableMessage() throws Exception { // #43398
BuildException be = new BuildException("oops", new Location("build.xml", 1, 0));
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
index baf0b20..3691d94 100644
--- a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java
@@ -21,8 +21,8 @@ package org.apache.tools.ant;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.IOException;
@@ -62,7 +62,7 @@ public class DirectoryScannerTest {
ds.setBasedir(new File(buildRule.getProject().getProperty("output")));
ds.setIncludes(new String[] {"alpha"});
ds.scan();
- compareFiles(ds, new String[] {} ,new String[] {"alpha"});
+ compareFiles(ds, new String[] {}, new String[] {"alpha"});
}
@Test
@@ -244,7 +244,7 @@ public class DirectoryScannerTest {
* Only supports test on Linux at the moment because Java has
* no real notion of symlinks built in, so an os-specfic call
* to Runtime.exec() must be made to create a link to test against.
- * @throws InterruptedException
+ * @throws InterruptedException if something goes wrong
*/
@Test
public void testSetFollowLinks() throws IOException, InterruptedException {
@@ -276,13 +276,13 @@ public class DirectoryScannerTest {
boolean haveZipPackage = false;
boolean haveTaskdefsPackage = false;
- String[] included = ds.getIncludedDirectories();
- for (int i=0; i<included.length; i++) {
- if (included[i].equals("zip")) {
+ String[] includeds = ds.getIncludedDirectories();
+ for (String included : includeds) {
+ if (included.equals("zip")) {
haveZipPackage = true;
- } else if (included[i].equals("ThisIsALink"
- + File.separator
- + "taskdefs")) {
+ } else if (included.equals("ThisIsALink"
+ + File.separator
+ + "taskdefs")) {
haveTaskdefsPackage = true;
}
}
@@ -291,9 +291,7 @@ public class DirectoryScannerTest {
// bypass the excludes.
assertTrue("(1) zip package included", haveZipPackage);
- assertTrue("(1) taskdefs package included",
- haveTaskdefsPackage);
-
+ assertTrue("(1) taskdefs package included", haveTaskdefsPackage);
ds = new DirectoryScanner();
ds.setFollowSymlinks(false);
@@ -304,19 +302,18 @@ public class DirectoryScannerTest {
haveZipPackage = false;
haveTaskdefsPackage = false;
- included = ds.getIncludedDirectories();
- for (int i=0; i<included.length; i++) {
- if (included[i].equals("zip")) {
+ includeds = ds.getIncludedDirectories();
+ for (String included : includeds) {
+ if (included.equals("zip")) {
haveZipPackage = true;
- } else if (included[i].equals("ThisIsALink"
- + File.separator
- + "taskdefs")) {
+ } else if (included.equals("ThisIsALink"
+ + File.separator
+ + "taskdefs")) {
haveTaskdefsPackage = true;
}
}
assertTrue("(2) zip package included", haveZipPackage);
- assertTrue("(2) taskdefs package not included",
- !haveTaskdefsPackage);
+ assertFalse("(2) taskdefs package not included", haveTaskdefsPackage);
} finally {
if (!linkFile.delete()) {
@@ -491,7 +488,7 @@ public class DirectoryScannerTest {
buildRule.getProject().executeTarget("extended-setup");
DirectoryScanner ds = new DirectoryScanner();
String tmpdir = buildRule.getProject().getProperty("output").replace(
- File.separatorChar, '/') ;
+ File.separatorChar, '/');
ds.setIncludes(new String[] {tmpdir + "/alpha/beta/**/*",
tmpdir + "/delta/*"});
ds.setExcludes(new String[] {"**/beta.xml"});
@@ -516,28 +513,28 @@ public class DirectoryScannerTest {
private void compareFiles(DirectoryScanner ds, String[] expectedFiles,
String[] expectedDirectories) {
- String includedFiles[] = ds.getIncludedFiles();
- String includedDirectories[] = ds.getIncludedDirectories();
+ String[] includedFiles = ds.getIncludedFiles();
+ String[] includedDirectories = ds.getIncludedDirectories();
assertEquals("file present: ", expectedFiles.length,
includedFiles.length);
assertEquals("directories present: ", expectedDirectories.length,
includedDirectories.length);
TreeSet<String> files = new TreeSet<String>();
- for (int counter = 0; counter < includedFiles.length; counter++) {
- files.add(includedFiles[counter].replace(File.separatorChar, '/'));
+ for (String includedFile : includedFiles) {
+ files.add(includedFile.replace(File.separatorChar, '/'));
}
TreeSet<String> directories = new TreeSet<String>();
- for (int counter = 0; counter < includedDirectories.length; counter++) {
- directories.add(includedDirectories[counter]
- .replace(File.separatorChar, '/'));
+ for (String includedDirectory : includedDirectories) {
+ directories.add(includedDirectory
+ .replace(File.separatorChar, '/'));
}
String currentfile;
Iterator<String> i = files.iterator();
int counter = 0;
while (i.hasNext()) {
- currentfile = (String) i.next();
+ currentfile = i.next();
assertEquals(expectedFiles[counter], currentfile);
counter++;
}
@@ -545,7 +542,7 @@ public class DirectoryScannerTest {
Iterator<String> dirit = directories.iterator();
counter = 0;
while (dirit.hasNext()) {
- currentdirectory = (String) dirit.next();
+ currentdirectory = dirit.next();
assertEquals(expectedDirectories[counter], currentdirectory);
counter++;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ExecutorTest.java b/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
index 80ec96f..b17554c 100644
--- a/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ExecutorTest.java
@@ -53,12 +53,24 @@ public class ExecutorTest implements BuildListener {
public void targetStarted(BuildEvent event) {
targetCount++;
}
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetFinished(BuildEvent event) {}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
- public void messageLogged(BuildEvent event) {}
+
+ public void buildStarted(BuildEvent event) {
+ }
+
+ public void buildFinished(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
+
+ public void messageLogged(BuildEvent event) {
+ }
@Before
public void setUp() {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java b/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
index 7c8ef75..d5444f9 100644
--- a/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ExtendedTaskdefTest.java
@@ -50,7 +50,7 @@ public class ExtendedTaskdefTest {
try {
buildRule.executeTarget("testRun");
fail("BuildException should have been thrown");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertContains("exception thrown by the subclass", "executing the Foo task", ex.getMessage());
}
}
@@ -60,7 +60,7 @@ public class ExtendedTaskdefTest {
try {
buildRule.executeTarget("testRun2");
fail("BuildException should have been thrown");
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertContains("exception thrown by the subclass", "executing the Foo task", ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/FileUtilities.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/FileUtilities.java b/src/tests/junit/org/apache/tools/ant/FileUtilities.java
index a9de5ce..79b5716 100644
--- a/src/tests/junit/org/apache/tools/ant/FileUtilities.java
+++ b/src/tests/junit/org/apache/tools/ant/FileUtilities.java
@@ -58,7 +58,6 @@ public class FileUtilities {
}
}
-
/**
* Modified the timestamp on a file so it's <tt>seconds</tt> earlier than it was before. Where <tt>file</tt>
* is a directory, this function recurses into all child files (and directories) and reduces their modified
@@ -66,7 +65,7 @@ public class FileUtilities {
* @param file the file to change, or the directory to change then recurse into
* @param seconds how many seconds to roll the timestamp back by
*/
- public static void rollbackTimetamps(File file, long seconds) {
+ public static void rollbackTimestamps(File file, long seconds) {
if (null == file || !file.exists()) {
return;
}
@@ -80,7 +79,7 @@ public class FileUtilities {
return;
}
for (File child : children) {
- rollbackTimetamps(child, seconds);
+ rollbackTimestamps(child, seconds);
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
index ca4085d..157438e 100644
--- a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
@@ -19,8 +19,8 @@
package org.apache.tools.ant;
import java.io.File;
-import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@@ -28,6 +28,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+
import org.apache.tools.ant.taskdefs.condition.Os;
import org.junit.Before;
import org.junit.ComparisonFailure;
@@ -96,7 +97,8 @@ public class IntrospectionHelperTest {
ih = IntrospectionHelper.getHelper(String.class);
try {
m = ih.getAddTextMethod();
- } catch (BuildException e) {}
+ } catch (BuildException e) {
+ }
}
@Test
@@ -219,7 +221,7 @@ public class IntrospectionHelperTest {
Class expect = (Class) elemMap.get(name);
assertNotNull("Support for "+name+" in IntrospectioNHelperTest?",
expect);
- assertEquals("Return type of "+name, expect, ih.getElementType(name));
+ assertEquals("Return type of " + name, expect, ih.getElementType(name));
elemMap.remove(name);
}
assertTrue("Found all", elemMap.isEmpty());
@@ -244,7 +246,8 @@ public class IntrospectionHelperTest {
try {
actualMap.clear();
//TODO we should be asserting a value somewhere in here
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ }
}
@Test
@@ -274,7 +277,8 @@ public class IntrospectionHelperTest {
return null;
}
- public void createThree() {}
+ public void createThree() {
+ }
public Object[] createFour() {
return null;
@@ -292,19 +296,24 @@ public class IntrospectionHelperTest {
throw new NullPointerException();
}
- public void addSeven(String s, String s2) {}
+ public void addSeven(String s, String s2) {
+ }
- public void addEight() {}
+ public void addEight() {
+ }
public String addNine(String s) {
return null;
}
- public void addTen(String[] s) {}
+ public void addTen(String[] s) {
+ }
- public void addEleven(int i) {}
+ public void addEleven(int i) {
+ }
- public void addTwelve(Class c) {}
+ public void addTwelve(Class c) {
+ }
public void addThirteen(StringBuffer sb) {
sb.append("test");
@@ -376,7 +385,7 @@ public class IntrospectionHelperTest {
ih.setAttribute(p, this, "ten", "2");
try {
ih.setAttribute(p, this, "ten", "3");
- fail(projectBasedir+"2 shouldn't be equals to "+projectBasedir+"3");
+ fail(projectBasedir + "2 shouldn't be equals to " + projectBasedir + "3");
} catch (BuildException be) {
assertTrue(be.getCause() instanceof AssertionError);
}
@@ -515,7 +524,8 @@ public class IntrospectionHelperTest {
try {
actualMap.clear();
//TODO we should be asserting a value somewhere in here
- } catch (UnsupportedOperationException e) {}
+ } catch (UnsupportedOperationException e) {
+ }
}
@Test
@@ -565,13 +575,17 @@ public class IntrospectionHelperTest {
return 0;
}
- public void setThree() {}
+ public void setThree() {
+ }
- public void setFour(String s1, String s2) {}
+ public void setFour(String s1, String s2) {
+ }
- public void setFive(String[] s) {}
+ public void setFive(String[] s) {
+ }
- public void setSix(Project p) {}
+ public void setSix(Project p) {
+ }
public void setSeven(String s) {
assertEquals("2", s);
@@ -588,11 +602,11 @@ public class IntrospectionHelperTest {
public void setTen(File f) {
String path = f.getAbsolutePath();
if (Os.isFamily("unix") || Os.isFamily("openvms")) {
- assertEquals(projectBasedir+"2", path);
+ assertEquals(projectBasedir + "2", path);
} else if (Os.isFamily("netware")) {
- assertEquals(projectBasedir+"2", path.toLowerCase(Locale.US));
+ assertEquals(projectBasedir + "2", path.toLowerCase(Locale.US));
} else {
- assertEquals(":"+projectBasedir+"2",
+ assertEquals(":" + projectBasedir + "2",
path.toLowerCase(Locale.US).substring(1));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/MockBuildListener.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/MockBuildListener.java b/src/tests/junit/org/apache/tools/ant/MockBuildListener.java
index e3a96a8..654872c 100644
--- a/src/tests/junit/org/apache/tools/ant/MockBuildListener.java
+++ b/src/tests/junit/org/apache/tools/ant/MockBuildListener.java
@@ -32,17 +32,29 @@ public class MockBuildListener implements BuildListener {
this.project = project;
}
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetStarted(BuildEvent event) {}
- public void targetFinished(BuildEvent event) {}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+
+ public void buildFinished(BuildEvent event) {
+ }
+
+ public void targetStarted(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
public void messageLogged(final BuildEvent actual) {
- if(actual.getPriority()==Project.MSG_DEBUG)
+ if (actual.getPriority() == Project.MSG_DEBUG) {
return;
- assertTrue("unexpected messageLogged: "+actual.getMessage(), !buffer.isEmpty());
+ }
+ assertTrue("unexpected messageLogged: "+ actual.getMessage(), !buffer.isEmpty());
assertEquals("unexpected project ", project, actual.getProject());
BuildEvent expected = (BuildEvent) buffer.elementAt(0);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java b/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java
index 550c342..eec42f7 100644
--- a/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ProjectHelperRepositoryTest.java
@@ -78,7 +78,7 @@ public class ProjectHelperRepositoryTest {
public void testNoDefaultContructor() throws Exception {
class IncrrectHelper extends ProjectHelper {
- // the default constructor is not visible to ant here
+ // the default constructor is not visible to ant here
}
ProjectHelperRepository repo = ProjectHelperRepository.getInstance();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/ProjectTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ProjectTest.java b/src/tests/junit/org/apache/tools/ant/ProjectTest.java
index 89ed8c3..365e92d 100644
--- a/src/tests/junit/org/apache/tools/ant/ProjectTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ProjectTest.java
@@ -89,7 +89,7 @@ public class ProjectTest {
*/
String driveSpec = "C:";
String driveSpecLower = "c:";
-
+
assertEqualsIgnoreDriveCase(driveSpecLower + "\\",
p.resolveFile(driveSpec + "/", null).getPath());
assertEqualsIgnoreDriveCase(driveSpecLower + "\\",
@@ -168,8 +168,8 @@ public class ProjectTest {
private void assertEqualsIgnoreDriveCase(String s1, String s2) {
if ((Os.isFamily("dos") || Os.isFamily("netware"))
&& s1.length() >= 1 && s2.length() >= 1) {
- StringBuffer sb1 = new StringBuffer(s1);
- StringBuffer sb2 = new StringBuffer(s2);
+ StringBuilder sb1 = new StringBuilder(s1);
+ StringBuilder sb2 = new StringBuilder(s2);
sb1.setCharAt(0, Character.toUpperCase(s1.charAt(0)));
sb2.setCharAt(0, Character.toUpperCase(s2.charAt(0)));
assertEquals(sb1.toString(), sb2.toString());
@@ -184,9 +184,9 @@ public class ProjectTest {
try {
mbl.addBuildEvent(message, Project.MSG_ERR);
p.addTaskDefinition(dummyName, taskClass);
- fail("expected BuildException(\""+message+"\", Project.MSG_ERR) when adding task " + taskClass);
- }
- catch(BuildException e) {
+ fail(String.format("expected BuildException(\"%s\", Project.MSG_ERR) when adding task %s",
+ message, taskClass));
+ } catch (BuildException e) {
assertEquals(message, e.getMessage());
mbl.assertEmpty();
assertTrue(!p.getTaskDefinitions().containsKey(dummyName));
@@ -203,23 +203,27 @@ public class ProjectTest {
assertEquals(DummyTaskOkNonTask.class, p.getTaskDefinitions().get("OkNonTask"));
mbl.assertEmpty();
- assertTaskDefFails(DummyTaskPrivate.class, DummyTaskPrivate.class + " is not public");
-
+ assertTaskDefFails(DummyTaskPrivate.class,
+ DummyTaskPrivate.class + " is not public");
assertTaskDefFails(DummyTaskProtected.class,
- DummyTaskProtected.class + " is not public");
-
- assertTaskDefFails(DummyTaskPackage.class, DummyTaskPackage.class + " is not public");
-
- assertTaskDefFails(DummyTaskAbstract.class, DummyTaskAbstract.class + " is abstract");
- assertTaskDefFails(DummyTaskInterface.class, DummyTaskInterface.class + " is abstract");
-
- assertTaskDefFails(DummyTaskWithoutDefaultConstructor.class, "No public no-arg constructor in " + DummyTaskWithoutDefaultConstructor.class);
- assertTaskDefFails(DummyTaskWithoutPublicConstructor.class, "No public no-arg constructor in " + DummyTaskWithoutPublicConstructor.class);
-
- assertTaskDefFails(DummyTaskWithoutExecute.class, "No public execute() in " + DummyTaskWithoutExecute.class);
- assertTaskDefFails(DummyTaskWithNonPublicExecute.class, "No public execute() in " + DummyTaskWithNonPublicExecute.class);
-
- mbl.addBuildEvent("return type of execute() should be void but was \"int\" in " + DummyTaskWithNonVoidExecute.class, Project.MSG_WARN);
+ DummyTaskProtected.class + " is not public");
+ assertTaskDefFails(DummyTaskPackage.class,
+ DummyTaskPackage.class + " is not public");
+ assertTaskDefFails(DummyTaskAbstract.class,
+ DummyTaskAbstract.class + " is abstract");
+ assertTaskDefFails(DummyTaskInterface.class,
+ DummyTaskInterface.class + " is abstract");
+ assertTaskDefFails(DummyTaskWithoutDefaultConstructor.class,
+ "No public no-arg constructor in " + DummyTaskWithoutDefaultConstructor.class);
+ assertTaskDefFails(DummyTaskWithoutPublicConstructor.class,
+ "No public no-arg constructor in " + DummyTaskWithoutPublicConstructor.class);
+ assertTaskDefFails(DummyTaskWithoutExecute.class,
+ "No public execute() in " + DummyTaskWithoutExecute.class);
+ assertTaskDefFails(DummyTaskWithNonPublicExecute.class,
+ "No public execute() in " + DummyTaskWithNonPublicExecute.class);
+
+ mbl.addBuildEvent("return type of execute() should be void but was \"int\" in "
+ + DummyTaskWithNonVoidExecute.class, Project.MSG_WARN);
p.addTaskDefinition("NonVoidExecute", DummyTaskWithNonVoidExecute.class);
mbl.assertEmpty();
assertEquals(DummyTaskWithNonVoidExecute.class, p.getTaskDefinitions().get("NonVoidExecute"));
@@ -271,12 +275,18 @@ public class ProjectTest {
throws InterruptedException {
final String FOO = "foo", BAR = "bar";
p.addBuildListener(new BuildListener() {
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetStarted(BuildEvent event) {}
- public void targetFinished(BuildEvent event) {}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+ public void buildFinished(BuildEvent event) {
+ }
+ public void targetStarted(BuildEvent event) {
+ }
+ public void targetFinished(BuildEvent event) {
+ }
+ public void taskStarted(BuildEvent event) {
+ }
+ public void taskFinished(BuildEvent event) {
+ }
public void messageLogged(final BuildEvent actual) {
assertEquals(FOO, actual.getMessage());
// each of the following lines would cause an
@@ -309,19 +319,25 @@ public class ProjectTest {
}
private class DummyTaskPrivate extends Task {
- public DummyTaskPrivate() {}
- public void execute() {}
+ @SuppressWarnings("unused")
+ public DummyTaskPrivate() {
+ }
+ public void execute() {
+ }
}
protected class DummyTaskProtected extends Task {
- public DummyTaskProtected() {}
- public void execute() {}
+ public DummyTaskProtected() {
+ }
+ public void execute() {
+ }
}
-
class DummyTaskPackage extends Task {
- public DummyTaskPackage() {}
- public void execute() {}
+ public DummyTaskPackage() {
+ }
+ public void execute() {
+ }
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java b/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java
index 700b7c1..1fc745f 100644
--- a/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java
@@ -28,7 +28,7 @@ public class TaskContainerTest {
@Rule
public BuildFileRule buildRule = new BuildFileRule();
-
+
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/core/taskcontainer.xml");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java b/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java
index be7e21b..1bad429 100644
--- a/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java
+++ b/src/tests/junit/org/apache/tools/ant/UnknownElementTest.java
@@ -57,17 +57,22 @@ public class UnknownElementTest {
@Ignore("Previously disabled through naming convention")
public void XtestTaskFinishedEvent() {
buildRule.getProject().addBuildListener(new BuildListener() {
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetStarted(BuildEvent event) {}
- public void targetFinished(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+ public void buildFinished(BuildEvent event) {
+ }
+ public void targetStarted(BuildEvent event) {
+ }
+ public void targetFinished(BuildEvent event) {
+ }
public void taskStarted(BuildEvent event) {
assertTaskProperties(event.getTask());
}
public void taskFinished(BuildEvent event) {
assertTaskProperties(event.getTask());
}
- public void messageLogged(BuildEvent event) {}
+ public void messageLogged(BuildEvent event) {
+ }
private void assertTaskProperties(Task ue) {
assertNotNull(ue);
assertTrue(ue instanceof UnknownElement);
@@ -111,5 +116,3 @@ public class UnknownElementTest {
}
}
}
-
-
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java
index 3858354..06cd2f8 100644
--- a/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java
@@ -43,32 +43,28 @@ public class ConcatFilterTest {
+ "Line 1" + lSep
+ "Line 2" + lSep
+ "Line 3" + lSep
- + "Line 4" + lSep
- ;
+ + "Line 4" + lSep;
private static final String FILE_PREPEND =
"Line 1" + lSep
+ "Line 2" + lSep
+ "Line 3" + lSep
+ "Line 4" + lSep
- + "Line 5" + lSep
- ;
+ + "Line 5" + lSep;
private static final String FILE_APPEND_WITH =
"Line 57" + lSep
+ "Line 58" + lSep
+ "Line 59" + lSep
+ "Line 60" + lSep
- + "this-should-be-the-last-line" + lSep
- ;
+ + "this-should-be-the-last-line" + lSep;
private static final String FILE_APPEND =
"Line 56" + lSep
+ "Line 57" + lSep
+ "Line 58" + lSep
+ "Line 59" + lSep
- + "Line 60" + lSep
- ;
+ + "Line 60" + lSep;
@Rule
public BuildFileRule buildRule = new BuildFileRule();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java
index 5de7f6b..85df0ce 100644
--- a/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java
@@ -49,8 +49,6 @@ public class DynamicFilterTest {
assertContains("hellO wOrld", content);
}
-
-
public static class CustomFilter implements ChainableReader {
char replace = 'x';
char with = 'y';
@@ -65,14 +63,13 @@ public class DynamicFilterTest {
public Reader chain(final Reader rdr) {
return new BaseFilterReader(rdr) {
- public int read()
- throws IOException
- {
+ public int read() throws IOException {
int c = in.read();
- if (c == replace)
+ if (c == replace) {
return with;
- else
+ } else {
return c;
+ }
}
};
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java b/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java
index 7c910d1..21d25a1 100644
--- a/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java
+++ b/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java
@@ -38,7 +38,7 @@ public class HeadTailTest {
@Rule
public BuildFileRule buildRule = new BuildFileRule();
-
+
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/filters/head-tail.xml");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java b/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java
index 9dcb291..d10d951 100644
--- a/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java
@@ -32,10 +32,9 @@ import static org.junit.Assert.assertEquals;
public class LineContainsTest {
-
@Rule
public BuildFileRule buildRule = new BuildFileRule();
-
+
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/filters/build.xml");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
index daa7f2e..38835c4 100644
--- a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
@@ -251,9 +251,7 @@ public class TokenFilterTest {
// Helper methods
// -----------------------------------------------------
- private String getFileString(String filename)
- throws IOException
- {
+ private String getFileString(String filename) throws IOException {
Reader r = null;
try {
r = new FileReader(FILE_UTILS.resolveFile(buildRule.getProject().getBaseDir(),filename));
@@ -265,9 +263,7 @@ public class TokenFilterTest {
}
- public static class Capitalize
- implements TokenFilter.Filter
- {
+ public static class Capitalize implements TokenFilter.Filter {
public String filter(String token) {
if (token.length() == 0)
return token;
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java b/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java
index 0c3c24f..3184589 100644
--- a/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/launch/LocatorTest.java
@@ -33,7 +33,8 @@ public class LocatorTest {
private boolean windows;
private boolean unix;
private static final String LAUNCHER_JAR = "//morzine/slo/Java/Apache/ant/lib/ant-launcher.jar";
- private static final String SHARED_JAR_URI = "jar:file:"+ LAUNCHER_JAR +"!/org/apache/tools/ant/launch/Launcher.class";
+ private static final String SHARED_JAR_URI = "jar:file:" + LAUNCHER_JAR +
+ "!/org/apache/tools/ant/launch/Launcher.class";
@Before
@@ -84,8 +85,8 @@ public class LocatorTest {
/**
- * this isnt really a valid URI, except maybe in IE
- * @throws Exception
+ * this isn't really a valid URI, except maybe in IE
+ * @throws Exception if something goes wrong
*/
public void testNetworkURI() throws Exception {
resolveTo("file:\\\\PC03\\jclasses\\lib\\ant-1.7.0.jar", ""
@@ -126,7 +127,7 @@ public class LocatorTest {
*/
@Test
public void testAntOnRemoteShare() throws Throwable {
- String resolved=Locator.fromJarURI(SHARED_JAR_URI);
+ String resolved = Locator.fromJarURI(SHARED_JAR_URI);
assertResolved(SHARED_JAR_URI, LAUNCHER_JAR, resolved, unix);
assertResolved(SHARED_JAR_URI, LAUNCHER_JAR.replace('/', '\\'),
resolved, windows);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/AntLikeTasksAtTopLevelTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AntLikeTasksAtTopLevelTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AntLikeTasksAtTopLevelTest.java
index 298bf09..cb03609 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntLikeTasksAtTopLevelTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntLikeTasksAtTopLevelTest.java
@@ -67,4 +67,4 @@ public class AntLikeTasksAtTopLevelTest {
}
}
-}// AntLikeTasksAtTopLevelTest
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
index 0d6453c..b38857e 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
@@ -45,7 +45,7 @@ import static org.junit.Assert.fail;
/**
*/
public class AntTest {
-
+
@Rule
public BuildFileRule buildRule = new BuildFileRule();
@@ -415,12 +415,23 @@ public class AntTest {
expectedBasedirs = dirs;
}
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetFinished(BuildEvent event){}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
- public void messageLogged(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+
+ public void buildFinished(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
+
+ public void messageLogged(BuildEvent event) {
+ }
public void targetStarted(BuildEvent event) {
if (event.getTarget().getName().equals("")) {
@@ -455,12 +466,23 @@ public class AntTest {
this.value = value;
}
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetFinished(BuildEvent event){}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
- public void messageLogged(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+
+ public void buildFinished(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
+
+ public void messageLogged(BuildEvent event) {
+ }
public void targetStarted(BuildEvent event) {
if (event.getTarget().getName().equals("")) {
@@ -488,7 +510,7 @@ public class AntTest {
String[] l1 = expect.list();
String[] l2 = received.list();
if (l1.length == l2.length) {
- for (int i=0; i<l1.length; i++) {
+ for (int i = 0; i < l1.length; i++) {
if (!l1[i].equals(l2[i])) {
assertTrue(msg, !shouldBeEqual);
}
@@ -570,12 +592,23 @@ public class AntTest {
this.expectedValues = values;
}
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetFinished(BuildEvent event){}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
- public void messageLogged(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+
+ public void buildFinished(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
+
+ public void messageLogged(BuildEvent event) {
+ }
public void targetStarted(BuildEvent event) {
if (event.getTarget().getName().equals("")) {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java
index c5c78ab..70abe0c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntlibTest.java
@@ -19,8 +19,8 @@
package org.apache.tools.ant.taskdefs;
import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
@@ -42,11 +42,11 @@ public class AntlibTest {
/**
* only do the antlib tests if we are in the same JVM as ant.
- * @return
+ * @return boolean
*/
private boolean isSharedJVM() {
String property = System.getProperty("tests.and.ant.share.classloader");
- return property!=null && Project.toBoolean(property);
+ return property != null && Project.toBoolean(property);
}
@Test
@@ -89,7 +89,7 @@ public class AntlibTest {
Assume.assumeTrue("Test requires shared JVM", isSharedJVM());
buildRule.executeTarget("antlib_uri_auto2");
}
-
+
public static class MyTask extends Task {
public void execute() {
log("MyTask called");
@@ -103,4 +103,3 @@ public class AntlibTest {
}
}
-
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/AvailableTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AvailableTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AvailableTest.java
index ef97e37..ae87a5a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AvailableTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AvailableTest.java
@@ -34,10 +34,10 @@ import static org.junit.Assert.fail;
*/
public class AvailableTest {
-
+
@Rule
public BuildFileRule buildRule = new BuildFileRule();
-
+
@Before
public void setUp() {
buildRule.configureProject("src/etc/testcases/taskdefs/available.xml");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java b/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
index 9ea9a4f..0faacd1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/BUnzip2Test.java
@@ -19,6 +19,8 @@
package org.apache.tools.ant.taskdefs;
import java.io.File;
+import java.io.IOException;
+
import org.apache.tools.ant.BuildFileRule;
import org.apache.tools.ant.FileUtilities;
import org.junit.Before;
@@ -43,16 +45,16 @@ public class BUnzip2Test {
}
@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("File content mismatch after bunzip2",
FileUtilities.getFileContents(new File(outputDir, "asf-logo-huge-from-gzip.tar")),
@@ -60,7 +62,7 @@ public class BUnzip2Test {
}
@Test
- public void testDocumentationClaimsOnCopy() throws java.io.IOException {
+ public void testDocumentationClaimsOnCopy() throws IOException {
testRealTest("testDocumentationClaimsOnCopy");
}
}
[3/6] ant git commit: Checkstyle: mostly whitespace (cf master)
Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/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 de75404..3c22507 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<String>();
- 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<String>();
- 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/572a2490/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();
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
index 7c0fa16..2579c82 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunnerTest.java
@@ -17,10 +17,11 @@
*/
package org.apache.tools.ant.taskdefs.optional.junit;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -36,13 +37,11 @@ import org.junit.Test;
* They must be enhanced with time.
*
*/
-public class JUnitTestRunnerTest{
-
-
+public class JUnitTestRunnerTest {
// check that a valid method name generates no errors
@Test
- public void testValidMethod(){
+ public void testValidMethod() {
TestRunner runner = createRunnerForTestMethod(ValidMethodTestCase.class,"testA");
runner.run();
assertEquals(runner.getFormatter().getError(), JUnitTestRunner.SUCCESS, runner.getRetCode());
@@ -50,7 +49,7 @@ public class JUnitTestRunnerTest{
// check that having an invalid method name generates an error
@Test
- public void testInvalidMethod(){
+ public void testInvalidMethod() {
TestRunner runner = createRunnerForTestMethod(InvalidMethodTestCase.class,"testInvalid");
runner.run();
String error = runner.getFormatter().getError();
@@ -60,7 +59,7 @@ public class JUnitTestRunnerTest{
// check that having no suite generates no errors
@Test
- public void testNoSuite(){
+ public void testNoSuite() {
TestRunner runner = createRunner(NoSuiteTestCase.class);
runner.run();
assertEquals(runner.getFormatter().getError(), JUnitTestRunner.SUCCESS, runner.getRetCode());
@@ -68,7 +67,7 @@ public class JUnitTestRunnerTest{
// check that a suite generates no errors
@Test
- public void testSuite(){
+ public void testSuite() {
TestRunner runner = createRunner(SuiteTestCase.class);
runner.run();
assertEquals(runner.getFormatter().getError(), JUnitTestRunner.SUCCESS, runner.getRetCode());
@@ -76,7 +75,7 @@ public class JUnitTestRunnerTest{
// check that an invalid suite generates an error.
@Test
- public void testInvalidSuite(){
+ public void testInvalidSuite() {
TestRunner runner = createRunner(InvalidSuiteTestCase.class);
runner.run();
String error = runner.getFormatter().getError();
@@ -87,7 +86,7 @@ public class JUnitTestRunnerTest{
// check that something which is not a testcase generates no errors
// at first even though this is incorrect.
@Test
- public void testNoTestCase(){
+ public void testNoTestCase() {
TestRunner runner = createRunner(NoTestCase.class);
runner.run();
// On junit3 this is a FAILURE, on junit4 this is an ERROR
@@ -102,7 +101,7 @@ public class JUnitTestRunnerTest{
// check that an exception in the constructor is noticed
@Test
- public void testInvalidTestCase(){
+ public void testInvalidTestCase() {
TestRunner runner = createRunner(InvalidTestCase.class);
runner.run();
// On junit3 this is a FAILURE, on junit4 this is an ERROR
@@ -118,7 +117,7 @@ public class JUnitTestRunnerTest{
// check that JUnit 4 synthetic AssertionFailedError gets message and cause from AssertionError
@Test
- public void testJUnit4AssertionError(){
+ public void testJUnit4AssertionError() {
TestRunner runner = createRunnerForTestMethod(AssertionErrorTest.class,"throwsAssertionError");
runner.run();
@@ -130,12 +129,12 @@ public class JUnitTestRunnerTest{
assertEquals("cause message", cause.getMessage());
}
- protected TestRunner createRunner(Class<?> clazz){
+ protected TestRunner createRunner(Class<?> clazz) {
return new TestRunner(new JUnitTest(clazz.getName()), null,
true, true, true);
}
- protected TestRunner createRunnerForTestMethod(Class<?> clazz, String method){
+ protected TestRunner createRunnerForTestMethod(Class<?> clazz, String method) {
return new TestRunner(new JUnitTest(clazz.getName()), new String[] {method},
true, true, true);
}
@@ -144,7 +143,7 @@ public class JUnitTestRunnerTest{
private final static class TestRunner extends JUnitTestRunner {
private ResultFormatter formatter = new ResultFormatter();
TestRunner(JUnitTest test, String[] methods, boolean haltonerror,
- boolean filtertrace, boolean haltonfailure){
+ boolean filtertrace, boolean haltonfailure) {
super(test, methods, haltonerror, filtertrace, haltonfailure,
false, false, TestRunner.class.getClassLoader());
// use the classloader that loaded this class otherwise
@@ -152,7 +151,7 @@ public class JUnitTestRunnerTest{
// is ran in non-forked mode.
addFormatter(formatter);
}
- ResultFormatter getFormatter(){
+ ResultFormatter getFormatter() {
return formatter;
}
}
@@ -161,13 +160,20 @@ public class JUnitTestRunnerTest{
private final static class ResultFormatter implements JUnitResultFormatter {
private AssertionFailedError failure;
private Throwable error;
- public void setSystemOutput(String output){}
- public void setSystemError(String output){}
- public void startTestSuite(JUnitTest suite) throws BuildException{}
- public void endTestSuite(JUnitTest suite) throws BuildException{}
- public void setOutput(java.io.OutputStream out){}
- public void startTest(junit.framework.Test t) {}
- public void endTest(junit.framework.Test test) {}
+ public void setSystemOutput(String output) {
+ }
+ public void setSystemError(String output) {
+ }
+ public void startTestSuite(JUnitTest suite) throws BuildException{
+ }
+ public void endTestSuite(JUnitTest suite) throws BuildException{
+ }
+ public void setOutput(OutputStream out) {
+ }
+ public void startTest(junit.framework.Test t) {
+ }
+ public void endTest(junit.framework.Test test) {
+ }
public void addFailure(junit.framework.Test test, AssertionFailedError t) {
failure = t;
}
@@ -177,8 +183,8 @@ public class JUnitTestRunnerTest{
public void addError(junit.framework.Test test, Throwable t) {
error = t;
}
- String getError(){
- if (error == null){
+ String getError() {
+ if (error == null) {
return "";
}
StringWriter sw = new StringWriter();
@@ -191,54 +197,64 @@ public class JUnitTestRunnerTest{
}
public static class InvalidMethodTestCase extends TestCase {
- public InvalidMethodTestCase(String name){ super(name); }
- public void testA(){
+ public InvalidMethodTestCase(String name) {
+ super(name);
+ }
+ public void testA() {
throw new NullPointerException("thrown on purpose");
}
}
public static class ValidMethodTestCase extends TestCase {
- public ValidMethodTestCase(String name){ super(name); }
- public void testA(){
+ public ValidMethodTestCase(String name) {
+ super(name);
+ }
+ public void testA() {
// expected to be executed
}
- public void testB(){
+ public void testB() {
// should not be executed
throw new NullPointerException("thrown on purpose");
}
}
public static class InvalidTestCase extends TestCase {
- public InvalidTestCase(String name){
+ public InvalidTestCase(String name) {
super(name);
throw new NullPointerException("thrown on purpose");
}
}
public static class NoSuiteTestCase extends TestCase {
- public NoSuiteTestCase(String name){ super(name); }
- public void testA(){}
+ public NoSuiteTestCase(String name) {
+ super(name);
+ }
+ public void testA() {
+ }
}
public static class SuiteTestCase extends NoSuiteTestCase {
- public SuiteTestCase(String name){ super(name); }
- public static junit.framework.Test suite(){
+ public SuiteTestCase(String name) {
+ super(name);
+ }
+ public static junit.framework.Test suite() {
return new TestSuite(SuiteTestCase.class);
}
}
public static class InvalidSuiteTestCase extends NoSuiteTestCase {
- public InvalidSuiteTestCase(String name){ super(name); }
- public static junit.framework.Test suite(){
+ public InvalidSuiteTestCase(String name) {
+ super(name);
+ }
+ public static junit.framework.Test suite() {
throw new NullPointerException("thrown on purpose");
}
}
public static class AssertionErrorTest {
- @Test public void throwsAssertionError() {
- AssertionError assertionError = new AssertionError("failure message");
- assertionError.initCause(new RuntimeException("cause message"));
- throw assertionError;
+ @Test
+ public void throwsAssertionError() {
+ throw new AssertionError("failure message", new RuntimeException("cause message"));
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
index 2f3fdb7..a4b8ce9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelperTest.java
@@ -32,12 +32,9 @@ public class JUnitVersionHelperTest {
@Test
public void testMyOwnName() {
assertEquals("testMyOwnName",
- JUnitVersionHelper.getTestCaseName(
- JUnit4TestAdapterCache.getDefault().asTest(
- Description.createTestDescription(JUnitVersionHelperTest.class, "testMyOwnName")
- )
- )
- );
+ JUnitVersionHelper.getTestCaseName(JUnit4TestAdapterCache.getDefault()
+ .asTest(Description.createTestDescription(JUnitVersionHelperTest.class,
+ "testMyOwnName"))));
}
@Test
@@ -76,27 +73,38 @@ public class JUnitVersionHelperTest {
}
public static class Foo implements junit.framework.Test {
- public int countTestCases() {return 0;}
- public void run(TestResult result) {}
+ public int countTestCases() {
+ return 0;
+ }
+ public void run(TestResult result) {
+ }
}
public static class Foo1 extends Foo {
- public String getName() {return "I'm a foo";}
+ public String getName() {
+ return "I'm a foo";
+ }
}
public static class Foo2 extends Foo {
- public int getName() {return 1;}
+ public int getName() {
+ return 1;
+ }
}
public static class Foo3 extends Foo {
}
public static class Foo4 extends Foo {
- public String name() {return "I'm a foo, too";}
+ public String name() {
+ return "I'm a foo, too";
+ }
}
public static class Foo5 extends TestCase {
- public String getName() {return "overridden getName";}
+ public String getName() {
+ return "overridden getName";
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
index 1509894..ab8ccda 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.taskdefs.optional.junit;
-
import org.junit.Test;
public class Sleeper {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
index c8636b0..c3530ae 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
@@ -44,7 +44,9 @@ public class XMLResultAggregatorTest {
}
final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
if (d.exists()) {
- new Delete() {{removeDir(d);}}; // is there no utility method for this?
+ new Delete() {
+ { removeDir(d); }
+ }; // is there no utility method for this?
}
assertTrue(d.getAbsolutePath(), d.mkdir());
File xml = new File(d, "x.xml");
@@ -72,7 +74,8 @@ public class XMLResultAggregatorTest {
FileSet fs = new FileSet();
fs.setFile(xml);
task.addFileSet(fs);
- /* getResourceAsStream override unnecessary on JDK 7. Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
+ /* getResourceAsStream override unnecessary on JDK 7.
+ * Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
Thread.currentThread().setContextClassLoader(new ClassLoader(ClassLoader.getSystemClassLoader().getParent()) {
public InputStream getResourceAsStream(String name) {
if (name.startsWith("META-INF/services/")) {
@@ -85,7 +88,10 @@ public class XMLResultAggregatorTest {
// Use the JRE's Xerces, not lib/optional/xerces.jar:
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader().getParent());
// Tickle #51668:
- System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+ System.setSecurityManager(new SecurityManager() {
+ public void checkPermission(Permission perm) {
+ }
+ });
task.execute();
assertTrue(new File(d, "index.html").isFile());
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
index c7fab26..f8c89f2 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
@@ -60,7 +60,7 @@ public class FTPTest {
private FTPClient ftp;
- private boolean loginSuceeded = false;
+ private boolean loginSucceeded = false;
private String loginFailureMessage;
@@ -95,7 +95,7 @@ public class FTPTest {
if (connectionSucceeded) {
try {
ftp.login(remoteUser, password);
- loginSuceeded = true;
+ loginSucceeded = true;
} catch (IOException ioe) {
loginFailureMessage = "could not log on to " + remoteHost + " as user " + remoteUser;
}
@@ -105,7 +105,7 @@ public class FTPTest {
@After
public void tearDown() {
try {
- if (ftp!= null) {
+ if (ftp != null) {
ftp.disconnect();
}
} catch (IOException ioe) {
@@ -118,8 +118,7 @@ public class FTPTest {
boolean result = true;
try {
ftp.cwd(remoteDir);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
System.out.println("could not change directory to " + remoteTmpDir);
result = false;
}
@@ -128,45 +127,42 @@ public class FTPTest {
@Test
public void test1() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha"});
ds.scan();
- compareFiles(ds, new String[] {} ,new String[] {"alpha"});
+ compareFiles(ds, new String[] {}, new String[] {"alpha"});
}
@Test
public void test2() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/"});
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"},
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"},
new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
}
@Test
public void test3() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"},
- new String[] {"alpha", "alpha/beta",
- "alpha/beta/gamma"});
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"},
+ new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
}
@Test
public void testFullPathMatchesCaseSensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -177,34 +173,32 @@ public class FTPTest {
@Test
public void testFullPathMatchesCaseInsensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setCaseSensitive(false);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"});
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
- new String[] {});
+ compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, new String[] {});
}
@Test
public void test2ButCaseInsensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"ALPHA/"});
ds.setCaseSensitive(false);
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"},
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"},
new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
}
@Test
public void test2bisButCaseInsensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -241,10 +235,10 @@ public class FTPTest {
@Test
public void testGetFollowSymlinksTrue() {
Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("ftp-get-directory-symbolic-link");
- FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
+ FileSet fsDestination = buildRule.getProject().getReference("fileset-destination-without-selector");
DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
dsDestination.scan();
compareFiles(dsDestination, new String[] {"alpha/beta/gamma/gamma.xml"},
@@ -254,20 +248,19 @@ public class FTPTest {
@Test
public void testGetFollowSymlinksFalse() {
Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("ftp-get-directory-no-symbolic-link");
FileSet fsDestination = (FileSet) buildRule.getProject().getReference("fileset-destination-without-selector");
DirectoryScanner dsDestination = fsDestination.getDirectoryScanner(buildRule.getProject());
dsDestination.scan();
- compareFiles(dsDestination, new String[] {},
- new String[] {});
+ compareFiles(dsDestination, new String[] {}, new String[] {});
}
@Test
public void testAllowSymlinks() {
Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("symlink-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
@@ -282,7 +275,7 @@ public class FTPTest {
@Test
public void testProhibitSymlinks() {
Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("symlink-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
@@ -296,7 +289,7 @@ public class FTPTest {
@Test
public void testFileSymlink() {
Assume.assumeTrue("System does not support Symlinks", supportsSymlinks);
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("symlink-file-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
@@ -311,10 +304,9 @@ public class FTPTest {
// father and child pattern test
@Test
public void testOrderOfIncludePatternsIrrelevant() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
- String [] expectedFiles = {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"};
+ String [] expectedFiles = {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"};
String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" };
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -331,49 +323,43 @@ public class FTPTest {
@Test
public void testPatternsDifferInCaseScanningSensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"},
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"},
new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
}
@Test
public void testPatternsDifferInCaseScanningInsensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/"});
ds.setCaseSensitive(false);
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"},
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"},
new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
}
@Test
public void testFullpathDiffersInCaseScanningSensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
- ds.setIncludes(new String[] {
- "alpha/beta/gamma/gamma.xml",
- "alpha/beta/gamma/GAMMA.XML"
- });
+ ds.setIncludes(new String[] {"alpha/beta/gamma/gamma.xml", "alpha/beta/gamma/GAMMA.XML"});
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
- new String[] {});
+ compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, new String[] {});
}
@Test
public void testFullpathDiffersInCaseScanningInsensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -389,7 +375,7 @@ public class FTPTest {
@Test
public void testParentDiffersInCaseScanningSensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
@@ -402,89 +388,63 @@ public class FTPTest {
@Test
public void testParentDiffersInCaseScanningInsensitive() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"});
ds.setCaseSensitive(false);
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml"},
- new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"},
+ new String[] {"alpha", "alpha/beta", "alpha/beta/gamma"});
}
@Test
public void testExcludeOneFile() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
- ds.setIncludes(new String[] {
- "**/*.xml"
- });
- ds.setExcludes(new String[] {
- "alpha/beta/b*xml"
- });
+ ds.setIncludes(new String[] {"**/*.xml"});
+ ds.setExcludes(new String[] {"alpha/beta/b*xml"});
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
- new String[] {});
+ compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, new String[] {});
}
@Test
public void testExcludeHasPrecedence() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
- ds.setIncludes(new String[] {
- "alpha/**"
- });
- ds.setExcludes(new String[] {
- "alpha/**"
- });
+ ds.setIncludes(new String[] {"alpha/**"});
+ ds.setExcludes(new String[] {"alpha/**"});
ds.scan();
- compareFiles(ds, new String[] {},
- new String[] {});
-
+ compareFiles(ds, new String[] {}, new String[] {});
}
@Test
public void testAlternateIncludeExclude() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
- ds.setIncludes(new String[] {
- "alpha/**",
- "alpha/beta/gamma/**"
- });
- ds.setExcludes(new String[] {
- "alpha/beta/**"
- });
+ ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"});
+ ds.setExcludes(new String[] {"alpha/beta/**"});
ds.scan();
- compareFiles(ds, new String[] {},
- new String[] {"alpha"});
-
+ compareFiles(ds, new String[] {}, new String[] {"alpha"});
}
@Test
public void testAlternateExcludeInclude() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
- ds.setExcludes(new String[] {
- "alpha/**",
- "alpha/beta/gamma/**"
- });
- ds.setIncludes(new String[] {
- "alpha/beta/**"
- });
+ ds.setExcludes(new String[] {"alpha/**", "alpha/beta/gamma/**"});
+ ds.setIncludes(new String[] {"alpha/beta/**"});
ds.scan();
- compareFiles(ds, new String[] {},
- new String[] {});
-
+ compareFiles(ds, new String[] {}, new String[] {});
}
/**
@@ -492,26 +452,23 @@ public class FTPTest {
*/
@Test
public void testChildrenOfExcludedDirectory() {
- Assume.assumeTrue(loginFailureMessage, loginSuceeded);
+ Assume.assumeTrue(loginFailureMessage, loginSucceeded);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
buildRule.getProject().executeTarget("children-of-excluded-dir-setup");
FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setExcludes(new String[] {"alpha/**"});
ds.scan();
- compareFiles(ds, new String[] {"delta/delta.xml"},
- new String[] {"delta"});
+ compareFiles(ds, new String[] {"delta/delta.xml"}, new String[] {"delta"});
ds = myFTPTask.newScanner(ftp);
Assume.assumeTrue("Could not change remote directory", changeRemoteDir(remoteTmpDir));
ds.setBasedir(new File(buildRule.getProject().getBaseDir(), "tmp"));
ds.setExcludes(new String[] {"alpha"});
ds.scan();
- compareFiles(ds, new String[] {"alpha/beta/beta.xml",
- "alpha/beta/gamma/gamma.xml",
- "delta/delta.xml"},
+ compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml",
+ "delta/delta.xml"},
new String[] {"alpha/beta", "alpha/beta/gamma", "delta"});
-
}
/**
@@ -634,11 +591,8 @@ public class FTPTest {
*/
@Test
public void testConfiguration1() {
- int[] expectedCounts = {
- 1,1,0,1,0,0,0
- };
+ int[] expectedCounts = {1, 1, 0, 1, 0, 0, 0};
performConfigTest("configuration.1", expectedCounts);
-
}
/**
@@ -646,11 +600,8 @@ public class FTPTest {
*/
@Test
public void testConfiguration2() {
- int[] expectedCounts = {
- 1,0,0,1,1,0,0
- };
+ int[] expectedCounts = {1, 0, 0, 1, 1, 0, 0};
performConfigTest("configuration.2", expectedCounts);
-
}
/**
@@ -658,18 +609,13 @@ public class FTPTest {
*/
@Test
public void testConfiguration3() {
- int[] expectedCounts = {
- 1,0,1,0,0,1,0
- };
+ int[] expectedCounts = {1, 0, 1, 0, 0, 1, 0};
performConfigTest("configuration.3", expectedCounts);
-
}
@Test
public void testConfigurationLang() {
- int[] expectedCounts = {
- 1,1,0,0,0,0,1
- };
+ int[] expectedCounts = {1, 1, 0, 0, 0, 0, 1};
performConfigTest("configuration.lang.good", expectedCounts);
try {
@@ -684,9 +630,7 @@ public class FTPTest {
*/
@Test
public void testConfigurationNone() {
- int[] expectedCounts = {
- 0,0,0,0,0,0,0
- };
+ int[] expectedCounts = {0, 0, 0, 0, 0, 0, 0};
performConfigTest("configuration.none", expectedCounts);
}
@@ -700,17 +644,17 @@ public class FTPTest {
"custom config: system key = WINDOWS",
"custom config: default date format = yyyy/MM/dd HH:mm",
"custom config: server language code = de"
-
};
LogCounter counter = new LogCounter();
- for (int i=0; i < messages.length; i++) {
- counter.addLogMessageToSearch(messages[i]);
+ for (String message : messages) {
+ counter.addLogMessageToSearch(message);
}
buildRule.getProject().addBuildListener(counter);
buildRule.getProject().executeTarget(target);
- for (int i=0; i < messages.length; i++) {
- assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
+ for (int i = 0; i < messages.length; i++) {
+ assertEquals("target " + target + ":message " + i,
+ expectedCounts[i], counter.getMatchCount(messages[i]));
}
}
@@ -726,26 +670,26 @@ public class FTPTest {
private void compareFiles(DirectoryScanner ds, String[] expectedFiles,
String[] expectedDirectories) {
- String includedFiles[] = ds.getIncludedFiles();
- String includedDirectories[] = ds.getIncludedDirectories();
+ String[] includedFiles = ds.getIncludedFiles();
+ String[] includedDirectories = ds.getIncludedDirectories();
assertEquals("file present: ", expectedFiles.length,
includedFiles.length);
assertEquals("directories present: ", expectedDirectories.length,
includedDirectories.length);
- for (int counter=0; counter < includedFiles.length; counter++) {
+ for (int counter = 0; counter < includedFiles.length; counter++) {
includedFiles[counter] = includedFiles[counter].replace(File.separatorChar, '/');
}
Arrays.sort(includedFiles);
- for (int counter=0; counter < includedDirectories.length; counter++) {
+ for (int counter = 0; counter < includedDirectories.length; counter++) {
includedDirectories[counter] = includedDirectories[counter]
.replace(File.separatorChar, '/');
}
Arrays.sort(includedDirectories);
- for (int counter=0; counter < includedFiles.length; counter++) {
+ for (int counter = 0; counter < includedFiles.length; counter++) {
assertEquals(expectedFiles[counter], includedFiles[counter]);
}
- for (int counter=0; counter < includedDirectories.length; counter++) {
+ for (int counter = 0; counter < includedDirectories.length; counter++) {
assertEquals(expectedDirectories[counter], includedDirectories[counter]);
counter++;
}
@@ -771,31 +715,34 @@ public class FTPTest {
}
protected void getFile(FTPClient ftp, String dir, String filename)
- throws IOException, BuildException
- {
+ throws IOException, BuildException {
if (this.simulatedFailuresLeft > 0) {
this.simulatedFailuresLeft--;
throw new IOException("Simulated failure for testing");
}
super.getFile(ftp, dir, filename);
}
+
protected void executeRetryable(RetryHandler h, Retryable r,
- String filename) throws IOException
- {
+ String filename) throws IOException {
+
this.simulatedFailuresLeft = this.numberOfFailuresToSimulate;
super.executeRetryable(h, r, filename);
}
}
+
public static class oneFailureFTP extends myRetryableFTP {
public oneFailureFTP() {
super(1);
}
}
+
public static class twoFailureFTP extends myRetryableFTP {
public twoFailureFTP() {
super(2);
}
}
+
public static class threeFailureFTP extends myRetryableFTP {
public threeFailureFTP() {
super(3);
@@ -807,6 +754,7 @@ public class FTPTest {
super(new Random().nextInt(Short.MAX_VALUE));
}
}
+
public void testGetWithSelectorRetryable1() {
buildRule.getProject().addTaskDefinition("ftp", oneFailureFTP.class);
try {
@@ -864,14 +812,15 @@ public class FTPTest {
};
LogCounter counter = new LogCounter();
- for (int i=0; i < messages.length; i++) {
- counter.addLogMessageToSearch(messages[i]);
+ for (String message : messages) {
+ counter.addLogMessageToSearch(message);
}
buildRule.getProject().addBuildListener(counter);
buildRule.getProject().executeTarget(target);
- for (int i=0; i < messages.length; i++) {
- assertEquals("target "+target+":message "+ i, expectedCounts[i], counter.getMatchCount(messages[i]));
+ for (int i = 0; i < messages.length; i++) {
+ assertEquals("target " + target + ":message " + i,
+ expectedCounts[i], counter.getMatchCount(messages[i]));
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
index c45ec17..1354e52 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/sos/SOSTest.java
@@ -320,7 +320,7 @@ public class SOSTest {
try {
buildRule.executeTarget(target);
fail(errorMessage);
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals(exceptionMessage, ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java
index 2e00042..e19a37a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java
@@ -60,27 +60,26 @@ import static org.junit.Assert.fail;
*/
public class ScpTest {
+ private Scp scpTask;
private File tempDir;
private String sshHostUri = System.getProperty("scp.host");
- private int port = Integer.parseInt( System.getProperty( "scp.port", "22" ) );
+ private int port = Integer.parseInt(System.getProperty("scp.port", "22"));
private String knownHosts = System.getProperty("scp.known.hosts");
private List cleanUpList = new ArrayList();
- public ScpTest() {
+ @Before
+ public void setUp() {
+ scpTask = createTask();
if (System.getProperty("scp.tmp") != null) {
tempDir = new File(System.getProperty("scp.tmp"));
}
- }
-
- @Before
- public void setUp() {
cleanUpList.clear();
}
@After
public void tearDown() {
- for( Iterator i = cleanUpList.iterator(); i.hasNext(); ) {
+ for (Iterator i = cleanUpList.iterator(); i.hasNext();) {
File file = (File) i.next();
file.delete();
}
@@ -92,61 +91,59 @@ public class ScpTest {
File uploadFile = createTemporaryFile();
// upload
- Scp scpTask = createTask();
- scpTask.setFile( uploadFile.getPath() );
- scpTask.setTodir( sshHostUri );
+ scpTask.setFile(uploadFile.getPath());
+ scpTask.setTodir(sshHostUri);
scpTask.execute();
- File testFile = new File( tempDir.getPath() + File.separator +
- "download-testSingleFileUploadAndDownload.test" );
- addCleanup(testFile );
+ File testFile = new File(tempDir.getPath() + File.separator +
+ "download-testSingleFileUploadAndDownload.test");
+ addCleanup(testFile);
assertFalse("Assert that the testFile does not exist.", testFile.exists());
// download
scpTask = createTask();
- scpTask.setFile( sshHostUri + "/" + uploadFile.getName() );
- scpTask.setTodir( testFile.getPath() );
+ scpTask.setFile(sshHostUri + "/" + uploadFile.getName());
+ scpTask.setTodir(testFile.getPath());
scpTask.execute();
- assertTrue( "Assert that the testFile exists.", testFile.exists() );
- compareFiles( uploadFile, testFile );
+ assertTrue("Assert that the testFile exists.", testFile.exists());
+ compareFiles(uploadFile, testFile);
}
@Test
public void testMultiUploadAndDownload() throws IOException {
assertNotNull("system property scp.tmp must be set", tempDir);
List uploadList = new ArrayList();
- for( int i = 0; i < 5; i++ ) {
- uploadList.add( createTemporaryFile() );
+ for (int i = 0; i < 5; i++) {
+ uploadList.add(createTemporaryFile());
}
- Scp scp = createTask();
FilenameSelector selector = new FilenameSelector();
- selector.setName( "scp*" );
+ selector.setName("scp*");
FileSet fileset = new FileSet();
- fileset.setDir( tempDir );
- fileset.addFilename( selector );
- scp.addFileset( fileset );
- scp.setTodir( sshHostUri );
- scp.execute();
+ fileset.setDir(tempDir);
+ fileset.addFilename(selector);
+ scpTask.addFileset(fileset);
+ scpTask.setTodir(sshHostUri);
+ scpTask.execute();
- File multi = new File( tempDir, "multi" );
+ File multi = new File(tempDir, "multi");
multi.mkdir();
- addCleanup( multi );
+ addCleanup(multi);
- Scp scp2 = createTask();
- scp2.setFile( sshHostUri + "/scp*" );
- scp2.setTodir( multi.getPath() );
- scp2.execute();
+ scpTask = createTask();
+ scpTask.setFile(sshHostUri + "/scp*");
+ scpTask.setTodir(multi.getPath());
+ scpTask.execute();
FilesMatch match = new FilesMatch();
- for( Iterator i = uploadList.iterator(); i.hasNext(); ) {
- File f = (File)i.next();
- match.setFile1( f );
- File f2 = new File( multi, f.getName() );
- match.setFile2( f2 );
- assertTrue("Assert file '" + f.getPath() + "' and file '" +
- f2.getPath() + "'", match.eval() );
+ for (Iterator i = uploadList.iterator(); i.hasNext();) {
+ File f = (File) i.next();
+ match.setFile1(f);
+ File f2 = new File(multi, f.getName());
+ match.setFile2(f2);
+ assertTrue("Assert file '" + f.getPath() + "' and file '"
+ + f2.getPath() + "'", match.eval());
}
}
@@ -158,11 +155,9 @@ public class ScpTest {
uploadList.add(createTemporaryFile());
}
- Scp scp = createTask();
-
// reverse order resource collection
Sort sort = new Sort();
- sort.setProject(scp.getProject());
+ sort.setProject(scpTask.getProject());
Reverse reverse = new Reverse();
reverse.add(new Name());
sort.add(reverse);
@@ -170,56 +165,53 @@ public class ScpTest {
FilenameSelector selector = new FilenameSelector();
selector.setName("scp*");
FileSet fileset = new FileSet();
- fileset.setProject(scp.getProject());
+ fileset.setProject(scpTask.getProject());
fileset.setDir(tempDir);
fileset.addFilename(selector);
sort.add(fileset);
- scp.add(sort);
+ scpTask.add(sort);
- scp.setTodir(sshHostUri);
- scp.execute();
+ scpTask.setTodir(sshHostUri);
+ scpTask.execute();
}
@Test
public void testRemoteToDir() throws IOException {
- Scp scpTask = createTask();
// first try an invalid URI
try {
- scpTask.setRemoteTodir( "host:/a/path/without/an/at" );
+ scpTask.setRemoteTodir("host:/a/path/without/an/at");
fail("Expected a BuildException to be thrown due to invalid"
+ " remoteToDir");
- }
- catch (BuildException e)
- {
+ } catch (BuildException e) {
// expected
//TODO we should be asserting a value in here
}
// And this one should work
- scpTask.setRemoteTodir( "user:password@host:/a/path/with/an/at" );
+ scpTask.setRemoteTodir("user:password@host:/a/path/with/an/at");
// no exception
}
- public void addCleanup( File file ) {
- cleanUpList.add( file );
+ private void addCleanup(File file) {
+ cleanUpList.add(file);
}
private void compareFiles(File src, File dest) {
FilesMatch match = new FilesMatch();
- match.setFile1( src );
- match.setFile2( dest );
+ match.setFile1(src);
+ match.setFile2(dest);
- assertTrue( "Assert files are equal.", match.eval() );
+ assertTrue("Assert files are equal.", match.eval());
}
private File createTemporaryFile() throws IOException {
File uploadFile;
- uploadFile = File.createTempFile( "scp", "test", tempDir );
- FileWriter writer = new FileWriter( uploadFile );
+ uploadFile = File.createTempFile("scp", "test", tempDir);
+ FileWriter writer = new FileWriter(uploadFile);
writer.write("Can you hear me now?\n");
writer.close();
- addCleanup( uploadFile );
+ addCleanup(uploadFile);
return uploadFile;
}
@@ -227,13 +219,13 @@ public class ScpTest {
Scp scp = new Scp();
Project p = new Project();
p.init();
- scp.setProject( p );
- if( knownHosts != null ) {
- scp.setKnownhosts( knownHosts );
+ scp.setProject(p);
+ if (knownHosts != null) {
+ scp.setKnownhosts(knownHosts);
} else {
- scp.setTrust( true );
+ scp.setTrust(true);
}
- scp.setPort( port );
+ scp.setPort(port);
return scp;
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
index e36d683..b5f4bbf 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/unix/SymlinkTest.java
@@ -17,11 +17,11 @@
*/
/*
- * Since the initial version of this file was deveolped on the clock on
+ * Since the initial version of this file was developed on the clock on
* an NSF grant I should say the following boilerplate:
*
* This material is based upon work supported by the National Science
- * Foundaton under Grant No. EIA-0196404. Any opinions, findings, and
+ * Foundation under Grant No. EIA-0196404. Any opinions, findings, and
* conclusions or recommendations expressed in this material are those
* of the author and do not necessarily reflect the views of the
* National Science Foundation.
@@ -192,7 +192,7 @@ public class SymlinkTest {
buildRule.executeTarget("test-fileutils");
SymbolicLinkUtils su = SymbolicLinkUtils.getSymbolicLinkUtils();
- java.io.File f = new File(buildRule.getOutputDir(), "file1");
+ File f = new File(buildRule.getOutputDir(), "file1");
assertTrue(f.exists());
assertFalse(f.isDirectory());
assertTrue(f.isFile());
@@ -260,7 +260,7 @@ public class SymlinkTest {
f.getName()));
// it is not possible to find out that symbolic links pointing
- // to inexistent files or directories are symbolic links
+ // to nonexistent files or directories are symbolic links
// it used to be possible to detect this on Mac
// this is not true under Snow Leopard and JDK 1.5
// Removing special handling of MacOS until someone shouts
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
index aa96d8d..772c6c1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/vss/MSVSSTest.java
@@ -65,7 +65,7 @@ public class MSVSSTest implements MSVSSConstants {
private Project project;
@Before
- public void setUp(){
+ public void setUp() {
project = new Project();
project.setBasedir(".");
project.init();
@@ -82,8 +82,7 @@ public class MSVSSTest implements MSVSSConstants {
@Test
public void testGetCommandLine() {
String[] sTestCmdLine = {MSVSS.SS_EXE, MSVSS.COMMAND_GET, DS_VSS_PROJECT_PATH,
- MSVSS.FLAG_OVERRIDE_WORKING_DIR + project.getBaseDir()
- .getAbsolutePath()
+ MSVSS.FLAG_OVERRIDE_WORKING_DIR + project.getBaseDir().getAbsolutePath()
+ File.separator + LOCAL_PATH, MSVSS.FLAG_AUTORESPONSE_DEF,
MSVSS.FLAG_RECURSION, MSVSS.FLAG_VERSION + VERSION, MSVSS.FLAG_LOGIN
+ VSS_USERNAME + "," + VSS_PASSWORD, FLAG_FILETIME_UPDATED, FLAG_SKIP_WRITABLE};
@@ -238,7 +237,7 @@ public class MSVSSTest implements MSVSSConstants {
// Get today's date
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z");
- sdf.setTimeZone( TimeZone.getTimeZone("GMT") );
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String expected = sdf.format(date);
// Set up a VSSHistory task
@@ -270,7 +269,7 @@ public class MSVSSTest implements MSVSSConstants {
try {
buildRule.executeTarget(target);
fail(failMessage);
- } catch(BuildException ex) {
+ } catch (BuildException ex) {
assertEquals(exceptionMessage, ex.getMessage());
}
}
@@ -462,8 +461,8 @@ public class MSVSSTest implements MSVSSConstants {
// Count the number of empty strings
int cnt = 0;
- for (int i = 0; i < genLength; i++) {
- if (sGeneratedCmdLine[i].equals("")) {
+ for (String argument : sGeneratedCmdLine) {
+ if (argument.equals("")) {
cnt++;
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
index 4f95c35..6dfbcf6 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
@@ -69,13 +69,13 @@ public class AddTypeTest {
@Test
public void testNestedB() {
buildRule.executeTarget("nested.b");
- AntAssert.assertContains( "add B called", buildRule.getLog());
+ AntAssert.assertContains("add B called", buildRule.getLog());
}
@Test
public void testNestedC() {
buildRule.executeTarget("nested.c");
- AntAssert.assertContains( "add C called", buildRule.getLog());
+ AntAssert.assertContains("add C called", buildRule.getLog());
}
@Test
@@ -91,19 +91,19 @@ public class AddTypeTest {
@Test
public void testConditionType() {
buildRule.executeTarget("condition.type");
- AntAssert.assertContains( "beforeafter", buildRule.getLog());
+ AntAssert.assertContains("beforeafter", buildRule.getLog());
}
@Test
public void testConditionTask() {
buildRule.executeTarget("condition.task");
- AntAssert.assertContains( "My Condition execution", buildRule.getLog());
+ AntAssert.assertContains("My Condition execution", buildRule.getLog());
}
@Test
public void testConditionConditionType() {
buildRule.executeTarget("condition.condition.type");
- AntAssert.assertContains( "My Condition eval", buildRule.getLog());
+ AntAssert.assertContains("My Condition eval", buildRule.getLog());
}
@Test
@@ -137,19 +137,25 @@ public class AddTypeTest {
// The following will be used as types and tasks
- public static interface A {}
- public static interface B {}
- public static interface C extends A {}
- public static interface AB extends A, B {}
+ public interface A {
+ }
+ public interface B {
+ }
+ public interface C extends A {
+ }
+ public interface AB extends A, B {
+ }
- public static class AImpl implements A{}
- public static class BImpl implements B{}
- public static class CImpl implements C{}
- public static class ABImpl implements AB{}
+ public static class AImpl implements A {
+ }
+ public static class BImpl implements B {
+ }
+ public static class CImpl implements C {
+ }
+ public static class ABImpl implements AB {
+ }
- public static class NestedContainer
- extends Task
- {
+ public static class NestedContainer extends Task {
public void add(A el) {
log("add A called");
}
@@ -161,9 +167,7 @@ public class AddTypeTest {
}
}
- public static class MyCondition
- implements Condition
- {
+ public static class MyCondition implements Condition {
Project project;
public void setProject(Project project) {
this.project = project;
@@ -177,8 +181,7 @@ public class AddTypeTest {
}
}
- public static class MyValue
- {
+ public static class MyValue {
private String text = "NOT SET YET";
public void addText(String text) {
this.text = text;
@@ -188,9 +191,7 @@ public class AddTypeTest {
}
}
- public static class MyAddConfigured
- extends Task
- {
+ public static class MyAddConfigured extends Task {
MyValue value;
public void addConfigured(MyValue value) {
log("value is " + value);
@@ -204,9 +205,7 @@ public class AddTypeTest {
}
}
- public static class MyAddConfiguredValue
- extends Task
- {
+ public static class MyAddConfiguredValue extends Task {
MyValue value;
public void addConfiguredValue(MyValue value) {
log("value is " + value);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
index 03d0c97..5e54f45 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java
@@ -43,14 +43,14 @@ public class AssertionsTest {
/**
* runs a test and expects an assertion thrown in forked code
- * @param target
+ * @param target String
*/
private void expectAssertion(String target) {
try {
buildRule.executeTarget(target);
fail("BuildException should have been thrown by assertion fail in task");
} catch (BuildException ex) {
- assertContains("assertion not thrown in "+target, "Java returned: 1", ex.getMessage());
+ assertContains("assertion not thrown in " + target, "Java returned: 1", ex.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
index abfb70f..53aa27c 100644
--- a/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineJavaTest.java
@@ -88,7 +88,7 @@ public class CommandlineJavaTest {
c.createClasspath(project).setLocation(project.resolveFile("build.xml"));
c.createClasspath(project).setLocation(project.resolveFile(
- System.getProperty(MagicNames.ANT_HOME)+"/lib/ant.jar"));
+ System.getProperty(MagicNames.ANT_HOME) + "/lib/ant.jar"));
s = c.getCommandline();
assertEquals("with classpath", 6, s.length);
// assertEquals("with classpath", "java", s[0]);
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java b/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
index e8e4442..ce728e8 100644
--- a/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/CommandlineTest.java
@@ -35,8 +35,8 @@ public class CommandlineTest {
public void testTokenizer() {
String[] s = Commandline.translateCommandline("1 2 3");
assertEquals("Simple case", 3, s.length);
- for (int i=0; i<3; i++) {
- assertEquals(""+(i+1), s[i]);
+ for (int i = 0; i < 3; i++) {
+ assertEquals("" + (i + 1), s[i]);
}
s = Commandline.translateCommandline("");
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java b/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
index 31b56f9..aeb7911 100644
--- a/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/DescriptionTest.java
@@ -36,24 +36,28 @@ public class DescriptionTest {
@Test
public void test1() {
buildRule.configureProject("src/etc/testcases/types/description1.xml");
- assertEquals("Single description failed", "Test Project Description", buildRule.getProject().getDescription());
+ assertEquals("Single description failed", "Test Project Description",
+ buildRule.getProject().getDescription());
}
@Test
public void test2() {
buildRule.configureProject("src/etc/testcases/types/description2.xml");
- assertEquals("Multi line description failed", "Multi Line\nProject Description", buildRule.getProject().getDescription());
+ assertEquals("Multi line description failed", "Multi Line\nProject Description",
+ buildRule.getProject().getDescription());
}
@Test
public void test3() {
buildRule.configureProject("src/etc/testcases/types/description3.xml");
- assertEquals("Multi instance description failed", "Multi Instance Project Description", buildRule.getProject().getDescription());
+ assertEquals("Multi instance description failed", "Multi Instance Project Description",
+ buildRule.getProject().getDescription());
}
@Test
public void test4() {
buildRule.configureProject("src/etc/testcases/types/description4.xml");
- assertEquals("Multi instance nested description failed", "Multi Instance Nested Project Description", buildRule.getProject().getDescription());
+ assertEquals("Multi instance nested description failed", "Multi Instance Nested Project Description",
+ buildRule.getProject().getDescription());
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java b/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
index dcb8a78..b20412e 100644
--- a/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/EnumeratedAttributeTest.java
@@ -36,11 +36,11 @@ public class EnumeratedAttributeTest {
@Test
public void testContains() {
EnumeratedAttribute t1 = new TestNormal();
- for (int i=0; i<expected.length; i++) {
- assertTrue(expected[i]+" is in TestNormal",
- t1.containsValue(expected[i]));
- assertTrue(expected[i].toUpperCase()+" is in TestNormal",
- !t1.containsValue(expected[i].toUpperCase()));
+ for (String value : expected) {
+ assertTrue(value + " is in TestNormal",
+ t1.containsValue(value));
+ assertTrue(value.toUpperCase() + " is in TestNormal",
+ !t1.containsValue(value.toUpperCase()));
}
assertTrue("TestNormal doesn\'t have \"d\" attribute",
!t1.containsValue("d"));
@@ -64,11 +64,11 @@ public class EnumeratedAttributeTest {
@Test
public void testExceptions() {
EnumeratedAttribute t1 = new TestNormal();
- for (int i=0; i<expected.length; i++) {
+ for (String value : expected) {
try {
- t1.setValue(expected[i]);
+ t1.setValue(value);
} catch (BuildException be) {
- fail("unexpected exception for value "+expected[i]);
+ fail("unexpected exception for value " + value);
}
}
try {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java b/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
index 9a17687..7cf905e 100644
--- a/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
@@ -84,7 +84,7 @@ public class FilterSetTest {
@Test
public void testRecursive() {
String result = "it works line";
- String line="@test@ line";
+ String line = "@test@ line";
FilterSet fs = new FilterSet();
fs.addFilter("test", "@test1@");
fs.addFilter("test1","@test2@");
@@ -221,13 +221,14 @@ public class FilterSetTest {
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/572a2490/src/tests/junit/org/apache/tools/ant/types/PathTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PathTest.java b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
index 2ad1819..20c0b3a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PathTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PathTest.java
@@ -325,7 +325,7 @@ public class PathTest {
@Test
public void testSetLocation() {
Path p = new Path(project);
- p.setLocation(new File(File.separatorChar+"a"));
+ p.setLocation(new File(File.separatorChar + "a"));
String[] l = p.list();
if (isUnixStyle) {
assertEquals(1, l.length);
@@ -359,7 +359,7 @@ public class PathTest {
}
@Test
- public void testEmpyPath() {
+ public void testEmptyPath() {
Path p = new Path(project, "");
String[] l = p.list();
assertEquals("0 after construction", 0, l.length);
[4/6] ant git commit: Checkstyle: mostly whitespace (cf master)
Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
index f34c26c..e9db64b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SleepTest.java
@@ -33,8 +33,7 @@ public class SleepTest {
public final BuildFileRule buildRule = new BuildFileRule();
private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/";
- private final static int ERROR_RANGE=1000;
-
+ private final static int ERROR_RANGE = 1000;
@Before
public void setUp() {
@@ -43,34 +42,34 @@ public class SleepTest {
@Test
public void test1() {
- Timer timer=new Timer();
+ Timer timer = new Timer();
buildRule.executeTarget("test1");
timer.stop();
- assertTrue(timer.time()>=0);
+ assertTrue(timer.time() >= 0);
}
@Test
public void test2() {
- Timer timer=new Timer();
+ Timer timer = new Timer();
buildRule.executeTarget("test2");
timer.stop();
- assertTrue(timer.time()>=0);
+ assertTrue(timer.time() >= 0);
}
@Test
public void test3() {
- Timer timer=new Timer();
+ Timer timer = new Timer();
buildRule.executeTarget("test3");
timer.stop();
- assertTrue(timer.time()>=(2000-ERROR_RANGE));
+ assertTrue(timer.time() >= (2000 - ERROR_RANGE));
}
@Test
public void test4() {
- Timer timer=new Timer();
+ Timer timer = new Timer();
buildRule.executeTarget("test3");
timer.stop();
- assertTrue(timer.time()>=(2000-ERROR_RANGE) && timer.time()<60000);
+ assertTrue(timer.time() >= (2000 - ERROR_RANGE) && timer.time() < 60000);
}
@Test
@@ -85,10 +84,10 @@ public class SleepTest {
@Test
public void test6() {
- Timer timer=new Timer();
+ Timer timer = new Timer();
buildRule.executeTarget("test6");
timer.stop();
- assertTrue(timer.time()<2000);
+ assertTrue(timer.time() < 2000);
}
@@ -96,23 +95,23 @@ public class SleepTest {
* inner timer class
*/
private static class Timer {
- long start=0;
- long stop=0;
+ long start = 0;
+ long stop = 0;
public Timer() {
start();
}
public void start() {
- start=System.currentTimeMillis();
+ start = System.currentTimeMillis();
}
public void stop() {
- stop=System.currentTimeMillis();
+ stop = System.currentTimeMillis();
}
public long time() {
- return stop-start;
+ return stop - start;
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java
index 24c4e9d..a45a098 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java
@@ -64,7 +64,7 @@ public class StyleTest {
public void testTransferParameterSet() throws Exception {
expectFileContains("testTransferParameterSet", // target
buildRule.getOutputDir().getAbsoluteFile() + "/out.xml", // file
- "set='myvalue'"); // exptected string
+ "set='myvalue'"); // expected string
}
@Test
@@ -207,8 +207,7 @@ public class StyleTest {
private void expectFileContains(
String target, String filename, String contains)
- throws IOException
- {
+ throws IOException {
buildRule.executeTarget(target);
assertFileContains(filename, contains);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java
index 58ee4f3..7489015 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SubAntTest.java
@@ -84,7 +84,7 @@ public class SubAntTest {
});
}
-
+
@Test
public void testMultipleTargets() {
buildRule.executeTarget("multipleTargets");
@@ -93,13 +93,13 @@ public class SubAntTest {
assertContains("test2-one", buildRule.getLog());
assertContains("test2-two", buildRule.getLog());
}
-
+
@Test
public void testMultipleTargetsOneDoesntExist_FOEfalse() {
buildRule.executeTarget("multipleTargetsOneDoesntExist_FOEfalse");
assertContains("Target \"three\" does not exist in the project \"subant\"", buildRule.getLog());
}
-
+
@Test
public void testMultipleTargetsOneDoesntExist_FOEtrue() {
try {
@@ -130,12 +130,23 @@ public class SubAntTest {
expectedBasedirs = dirs;
}
- public void buildStarted(BuildEvent event) {}
- public void buildFinished(BuildEvent event) {}
- public void targetFinished(BuildEvent event){}
- public void taskStarted(BuildEvent event) {}
- public void taskFinished(BuildEvent event) {}
- public void messageLogged(BuildEvent event) {}
+ public void buildStarted(BuildEvent event) {
+ }
+
+ public void buildFinished(BuildEvent event) {
+ }
+
+ public void targetFinished(BuildEvent event) {
+ }
+
+ public void taskStarted(BuildEvent event) {
+ }
+
+ public void taskFinished(BuildEvent event) {
+ }
+
+ public void messageLogged(BuildEvent event) {
+ }
public void targetStarted(BuildEvent event) {
if (event.getTarget().getName().equals("")) {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
index 71921cb..033d1b9 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TStampTest.java
@@ -17,13 +17,13 @@
*/
package org.apache.tools.ant.taskdefs;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
-import java.util.TimeZone;
import java.util.Date;
-import java.text.SimpleDateFormat;
+import java.util.TimeZone;
-import org.apache.tools.ant.Project;
import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
import org.junit.Before;
import org.junit.Test;
@@ -59,7 +59,7 @@ public class TStampTest {
String today = project.getProperty("today");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z");
- sdf.setTimeZone( TimeZone.getTimeZone("GMT") );
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String expected = sdf.format(date);
assertEquals(expected, today);
@@ -68,7 +68,7 @@ public class TStampTest {
/**
* verifies that custom props have priority over the
* originals
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testWriteOrder() throws Exception {
@@ -81,7 +81,7 @@ public class TStampTest {
String today = project.getProperty("TODAY");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z");
- sdf.setTimeZone( TimeZone.getTimeZone("GMT") );
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String expected = sdf.format(date);
assertEquals(expected, today);
@@ -91,13 +91,13 @@ public class TStampTest {
/**
* verifies that custom props have priority over the
* originals
- * @throws Exception
+ * @throws Exception if something goes wrong
*/
@Test
public void testPrefix() throws Exception {
tstamp.setPrefix("prefix");
tstamp.execute();
- String prop= project.getProperty("prefix.DSTAMP");
+ String prop = project.getProperty("prefix.DSTAMP");
assertNotNull(prop);
}
@@ -110,7 +110,7 @@ public class TStampTest {
tstamp.setPrefix("prefix");
tstamp.execute();
- String prop= project.getProperty("prefix.format");
+ String prop = project.getProperty("prefix.format");
assertNotNull(prop);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
index 3d77ba1..9650dfc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java
@@ -165,7 +165,7 @@ public class TarTest {
File f1
= new File(buildRule.getProject().getProperty("output"), "untar/test8.xml");
if (! f1.exists()) {
- fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly");
+ fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work properly");
}
}
@@ -185,7 +185,7 @@ public class TarTest {
File f1
= new File(buildRule.getProject().getProperty("output"), "untar/test10.xml");
if (! f1.exists()) {
- fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly");
+ fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work properly");
}
}
@@ -195,7 +195,7 @@ public class TarTest {
File f1
= new File(buildRule.getProject().getProperty("output"), "untar/test11.xml");
if (! f1.exists()) {
- fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly");
+ fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work properly");
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/TestProcess.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TestProcess.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TestProcess.java
index 062003f..a61ca3c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TestProcess.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TestProcess.java
@@ -24,23 +24,17 @@ import org.junit.internal.AssumptionViolatedException;
* Interactive Testcase for Processdestroyer.
*
*/
-public class TestProcess
- implements Runnable
-{
+public class TestProcess implements Runnable {
private boolean run = true;
private boolean done = false;
- public void shutdown()
- {
- if (!done)
- {
+ public void shutdown() {
+ if (!done) {
System.out.println("shutting down TestProcess");
run = false;
- synchronized(this)
- {
- while (!done)
- {
+ synchronized (this) {
+ while (!done) {
try {
wait();
} catch (InterruptedException ie) {
@@ -53,10 +47,8 @@ public class TestProcess
}
}
- public void run()
- {
- for (int i = 0; i < 5 && run; i++)
- {
+ public void run() {
+ for (int i = 0; i < 5 && run; i++) {
System.out.println(Thread.currentThread().getName());
try {
@@ -66,29 +58,23 @@ public class TestProcess
}
}
- synchronized(this)
- {
+ synchronized (this) {
done = true;
notifyAll();
}
}
- public Thread getShutdownHook()
- {
+ public Thread getShutdownHook() {
return new TestProcessShutdownHook();
}
- private class TestProcessShutdownHook
- extends Thread
- {
- public void run()
- {
+ private class TestProcessShutdownHook extends Thread {
+ public void run() {
shutdown();
}
}
- public static void main(String[] args)
- {
+ public static void main(String[] args) {
TestProcess tp = new TestProcess();
new Thread(tp, "TestProcess thread").start();
Runtime.getRuntime().addShutdownHook(tp.getShutdownHook());
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
index 0a968b2..fe6902f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TouchTest.java
@@ -33,7 +33,7 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class TouchTest {
-
+
@Rule
public final BuildFileRule buildRule = new BuildFileRule();
@@ -56,7 +56,7 @@ public class TouchTest {
public long getTargetTime() {
File file = new File(System.getProperty("root"), TOUCH_FILE);
- if(!file.exists()) {
+ if (!file.exists()) {
throw new BuildException("failed to touch file " + file);
}
return file.lastModified();
@@ -94,7 +94,7 @@ public class TouchTest {
*/
@Test
public void testNow() {
- long now=System.currentTimeMillis();
+ long now = System.currentTimeMillis();
buildRule.executeTarget("testNow");
long time = getTargetTime();
assertTimesNearlyMatch(time,now,5000);
@@ -179,8 +179,8 @@ public class TouchTest {
/**
* run a target to touch the test file; verify the timestamp is as expected
- * @param targetName
- * @param timestamp
+ * @param targetName String
+ * @param timestamp long
*/
private void touchFile(String targetName, long timestamp) {
buildRule.executeTarget(targetName);
@@ -190,8 +190,8 @@ public class TouchTest {
/**
* assert that two times are within the current FS granularity;
- * @param timestamp
- * @param time
+ * @param timestamp long
+ * @param time long
*/
public void assertTimesNearlyMatch(long timestamp,long time) {
long granularity= FILE_UTILS.getFileTimestampGranularity();
@@ -200,9 +200,9 @@ public class TouchTest {
/**
* assert that two times are within a specified range
- * @param timestamp
- * @param time
- * @param range
+ * @param timestamp long
+ * @param time long
+ * @param range long
*/
private void assertTimesNearlyMatch(long timestamp, long time, long range) {
assertTrue("Time " + timestamp + " is not within " + range + " ms of "
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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 cb274a8..1d93b92 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.
@@ -355,6 +359,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();
@@ -498,7 +503,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/572a2490/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/572a2490/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
index 2a2354f..271c19b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
@@ -29,7 +29,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/**
-
+
*/
public class ParserSupportsTest {
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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 d043b59..b7ab748 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());
}
}// ReplaceRegExpTest
http://git-wip-us.apache.org/repos/asf/ant/blob/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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/572a2490/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 {
[5/6] ant git commit: Checkstyle: mostly whitespace (cf master)
Posted by gi...@apache.org.
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);