Checkstyle: mostly whitespace Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/866ce9f5 Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/866ce9f5 Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/866ce9f5
Branch: refs/heads/master Commit: 866ce9f550d2c7d3fa44319f8acbfb75a3ad3c42 Parents: fc2bce5 Author: Gintas Grigelionis <[email protected]> Authored: Fri Dec 1 21:18:02 2017 +0100 Committer: Gintas Grigelionis <[email protected]> Committed: Fri Dec 1 21:18:02 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 +- .../core/location/src/task/EchoLocation.java | 2 +- .../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 | 13 +- .../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 | 58 +++-- .../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 | 71 ++++-- .../apache/tools/ant/taskdefs/AntlibTest.java | 6 +- .../apache/tools/ant/taskdefs/BUnzip2Test.java | 10 +- .../apache/tools/ant/taskdefs/BZip2Test.java | 4 +- .../apache/tools/ant/taskdefs/CVSPassTest.java | 28 +-- .../apache/tools/ant/taskdefs/ChecksumTest.java | 4 +- .../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 | 7 +- .../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 | 24 +- .../apache/tools/ant/taskdefs/MkdirTest.java | 4 +- .../apache/tools/ant/taskdefs/MultiMapTest.java | 15 +- .../apache/tools/ant/taskdefs/ParallelTest.java | 2 +- .../apache/tools/ant/taskdefs/PropertyTest.java | 6 +- .../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 | 23 +- .../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 | 18 +- .../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/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/RhinoScriptTest.java | 3 +- .../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 | 124 +++++----- .../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 | 15 +- .../tools/ant/util/ResourceUtilsTest.java | 8 +- .../apache/tools/ant/util/StringUtilsTest.java | 85 ++++--- .../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 +- 180 files changed, 1697 insertions(+), 1623 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/.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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/src/tests/antunit/core/location/src/task/EchoLocation.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/core/location/src/task/EchoLocation.java b/src/tests/antunit/core/location/src/task/EchoLocation.java index a2031e6..ce54c03 100644 --- a/src/tests/antunit/core/location/src/task/EchoLocation.java +++ b/src/tests/antunit/core/location/src/task/EchoLocation.java @@ -6,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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..6eedf9e 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"); @@ -103,11 +105,12 @@ public class AntClassLoaderDelegationTest { 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)) { @@ -118,7 +121,7 @@ public class AntClassLoaderDelegationTest { return Collections.enumeration(Collections.EMPTY_SET); } } - + } - + } http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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 424fb8e..33782e0 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.nio.file.Path; import java.nio.file.Paths; import java.util.Enumeration; @@ -30,6 +30,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; @@ -98,7 +99,8 @@ public class IntrospectionHelperTest { ih = IntrospectionHelper.getHelper(String.class); try { m = ih.getAddTextMethod(); - } catch (BuildException e) {} + } catch (BuildException e) { + } } @Test @@ -221,7 +223,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()); @@ -246,7 +248,8 @@ public class IntrospectionHelperTest { try { actualMap.clear(); //TODO we should be asserting a value somewhere in here - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + } } @Test @@ -276,7 +279,8 @@ public class IntrospectionHelperTest { return null; } - public void createThree() {} + public void createThree() { + } public Object[] createFour() { return null; @@ -294,19 +298,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"); @@ -378,7 +387,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); } @@ -518,7 +527,8 @@ public class IntrospectionHelperTest { try { actualMap.clear(); //TODO we should be asserting a value somewhere in here - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + } } @Test @@ -570,13 +580,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); @@ -593,11 +607,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)); } } @@ -642,11 +656,11 @@ public class IntrospectionHelperTest { public void setTwenty(Path p) { String path = p.toAbsolutePath().toString(); if (Os.isFamily("unix") || Os.isFamily("openvms")) { - assertEquals(projectBasedir+"20", path); + assertEquals(projectBasedir + "20", path); } else if (Os.isFamily("netware")) { - assertEquals(projectBasedir+"20", path.toLowerCase(Locale.US)); + assertEquals(projectBasedir + "20", path.toLowerCase(Locale.US)); } else { - assertEquals(":"+projectBasedir+"20", + assertEquals(":" + projectBasedir + "20", path.toLowerCase(Locale.US).substring(1)); } } http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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/866ce9f5/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..1a1fea8 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java @@ -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/866ce9f5/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..ee11483 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 http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/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"); } } http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/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/866ce9f5/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..96aad21 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; @@ -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/866ce9f5/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..061b341 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ChecksumTest.java @@ -18,14 +18,14 @@ 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 http://git-wip-us.apache.org/repos/asf/ant/blob/866ce9f5/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); } - }
