You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2015/04/18 22:26:37 UTC

[07/22] ant git commit: fix some lineends

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/types/selectors/README
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/README b/src/tests/junit/org/apache/tools/ant/types/selectors/README
index eb48f6b..de407b4 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/README
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/README
@@ -1,96 +1,96 @@
-A DESCRIPTION OF THE SELECTOR TEST FRAMEWORK
-
-When writing tests for selectors, I found that I wanted to have some
-standard way of working with a set of files and testing whether one or
-another of them was selected. To that end, I created a base class called
-BaseSelectorTest that does most of the heavy lifting. Of course, you can
-test your selectors any way you want, but if you want to reuse this code,
-read on.
-
-What BaseSelectorTest does is use an ant build file
-"src/etc/testcases/types/selector.xml" to copy a tree of files out of
-"src/etc/testcases/taskdefs/expected" into a "selectortest" directories.
-Then it takes a list of 12 of the files and directories in this tree, and
-applies whatever selector you pass in to each one. It passes back to your
-test a 12 character long string indicating which of the 12 files and
-directories was selected, using 'T' for selected and 'F' for not selected.
-In the Test class for your selector, you override the getInstance() method
-to create your own type of selector, and set the elements of your selector
-a variety of ways to ensure that the string of T's and F's returned when
-the selector is applied to those 12 files is correct.
-
-So, for example, DepthSelectorTest.java extends BaseSelectorTest and has
-the following code:
-
-
-    public BaseSelector getInstance() {
-        return new DepthSelector();
-    }
-
-
-    public void testSelectionBehaviour() {
-        DepthSelector s;
-        String results;
-
-
-        try {
-            makeBed();
-
-
-            s = (DepthSelector)getInstance();
-            s.setMin(20);
-            s.setMax(25);
-            results = selectionString(s);
-            assertEquals("FFFFFFFFFFFF", results);
-
-
-            s = (DepthSelector)getInstance();
-            s.setMin(0);
-            results = selectionString(s);
-            assertEquals("TTTTTTTTTTTT", results);
-
-
-            s = (DepthSelector)getInstance();
-            s.setMin(1);
-            results = selectionString(s);
-            assertEquals("FFFFFTTTTTTT", results);
-
-
-The first test says that none of the 12 files or directories will match if
-the depth range for the selector is between 20 and 25 (that would be one
-deep directory tree!). The second says that all files and directories
-match if the minimum depth is set to 0 and the maximum isn't specified. The
-third test says that if the minumum depth is 1, the first 5 entries in the
-list of 12 will not be selected and the rest will.
-
-
-You can find the 12 files and directories that are tested for selection in
-the BaseSelectorTest class. I used a fixed list so that if someone added
-new files to the src/etc/testcases/types directory it wouldn't break my
-tests:
-
-
-    protected String[] filenames = {".","asf-logo.gif.md5","asf-
-    logo.gif.bz2",
-            "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-
-            logo.gif.zip",
-            "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
-            "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
-            "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
-
-
-If you wish to use this set of files and directories to test your selector,
-you can reuse the BaseSelectorTest with no change to it.
-
-You may find you need to alter the build file so that you get some
-variation in the files that your selector can work with. Most of the core
-selectors have required that kind of modification. If you do that, make
-sure that it doesn't alter the output strings on the other selector test,
-or if it does that you update their expected return results.
-
-You may also want to alter the set of files you look at in a particular
-selector test. Since the filelist in BaseSelectorTest is protected, you
-should be able to override it as you need to. Or you can alter the fileset
-in BaseSelectorTest itself, provided you update the test strings in all the
-other unit tests.
-
+A DESCRIPTION OF THE SELECTOR TEST FRAMEWORK
+
+When writing tests for selectors, I found that I wanted to have some
+standard way of working with a set of files and testing whether one or
+another of them was selected. To that end, I created a base class called
+BaseSelectorTest that does most of the heavy lifting. Of course, you can
+test your selectors any way you want, but if you want to reuse this code,
+read on.
+
+What BaseSelectorTest does is use an ant build file
+"src/etc/testcases/types/selector.xml" to copy a tree of files out of
+"src/etc/testcases/taskdefs/expected" into a "selectortest" directories.
+Then it takes a list of 12 of the files and directories in this tree, and
+applies whatever selector you pass in to each one. It passes back to your
+test a 12 character long string indicating which of the 12 files and
+directories was selected, using 'T' for selected and 'F' for not selected.
+In the Test class for your selector, you override the getInstance() method
+to create your own type of selector, and set the elements of your selector
+a variety of ways to ensure that the string of T's and F's returned when
+the selector is applied to those 12 files is correct.
+
+So, for example, DepthSelectorTest.java extends BaseSelectorTest and has
+the following code:
+
+
+    public BaseSelector getInstance() {
+        return new DepthSelector();
+    }
+
+
+    public void testSelectionBehaviour() {
+        DepthSelector s;
+        String results;
+
+
+        try {
+            makeBed();
+
+
+            s = (DepthSelector)getInstance();
+            s.setMin(20);
+            s.setMax(25);
+            results = selectionString(s);
+            assertEquals("FFFFFFFFFFFF", results);
+
+
+            s = (DepthSelector)getInstance();
+            s.setMin(0);
+            results = selectionString(s);
+            assertEquals("TTTTTTTTTTTT", results);
+
+
+            s = (DepthSelector)getInstance();
+            s.setMin(1);
+            results = selectionString(s);
+            assertEquals("FFFFFTTTTTTT", results);
+
+
+The first test says that none of the 12 files or directories will match if
+the depth range for the selector is between 20 and 25 (that would be one
+deep directory tree!). The second says that all files and directories
+match if the minimum depth is set to 0 and the maximum isn't specified. The
+third test says that if the minumum depth is 1, the first 5 entries in the
+list of 12 will not be selected and the rest will.
+
+
+You can find the 12 files and directories that are tested for selection in
+the BaseSelectorTest class. I used a fixed list so that if someone added
+new files to the src/etc/testcases/types directory it wouldn't break my
+tests:
+
+
+    protected String[] filenames = {".","asf-logo.gif.md5","asf-
+    logo.gif.bz2",
+            "asf-logo.gif.gz","copy.filterset.filtered","zip/asf-
+            logo.gif.zip",
+            "tar/asf-logo.gif.tar","tar/asf-logo-huge.tar.gz",
+            "tar/gz/asf-logo.gif.tar.gz","tar/bz2/asf-logo.gif.tar.bz2",
+            "tar/bz2/asf-logo-huge.tar.bz2","tar/bz2"};
+
+
+If you wish to use this set of files and directories to test your selector,
+you can reuse the BaseSelectorTest with no change to it.
+
+You may find you need to alter the build file so that you get some
+variation in the files that your selector can work with. Most of the core
+selectors have required that kind of modification. If you do that, make
+sure that it doesn't alter the output strings on the other selector test,
+or if it does that you update their expected return results.
+
+You may also want to alter the set of files you look at in a particular
+selector test. Since the filelist in BaseSelectorTest is protected, you
+should be able to override it as you need to. Or you can alter the fileset
+in BaseSelectorTest itself, provided you update the test strings in all the
+other unit tests.
+

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
index 1eb40dc..29da454 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
@@ -1,54 +1,54 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.types.selectors;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-/**
- * Testcase for the <signedselector> selector.
- *
- */
-public class SignedSelectorTest {
-
-    @Rule
-    public BuildFileRule buildRule = new BuildFileRule();
-
-    @Before
-    public void setUp() {
-        buildRule.configureProject("src/etc/testcases/types/selectors/signedselector.xml");
-    }
-
-    @Test
-    public void testSelectSigned() {
-        buildRule.executeTarget("selectsigned");
-    }
-
-    @Test
-    public void testNotSelected() {
-        buildRule.executeTarget("notselected");
-    }
-
-    @Test
-    public void testName() {
-        buildRule.executeTarget("name");
-    }
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.types.selectors;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Testcase for the <signedselector> selector.
+ *
+ */
+public class SignedSelectorTest {
+
+    @Rule
+    public BuildFileRule buildRule = new BuildFileRule();
+
+    @Before
+    public void setUp() {
+        buildRule.configureProject("src/etc/testcases/types/selectors/signedselector.xml");
+    }
+
+    @Test
+    public void testSelectSigned() {
+        buildRule.executeTarget("selectsigned");
+    }
+
+    @Test
+    public void testNotSelected() {
+        buildRule.executeTarget("notselected");
+    }
+
+    @Test
+    public void testName() {
+        buildRule.executeTarget("name");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/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 0e543f1..4cec0bd 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
@@ -1,237 +1,237 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.types.selectors;
-
-import java.util.Locale;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.types.Parameter;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Size Selectors
- *
- */
-public class SizeSelectorTest {
-    
-    @Rule
-    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        SizeSelector s = new SizeSelector();
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector did not check for required fields");
-        } catch (BuildException be1) {
-            assertEquals("The value attribute is required, and must "
-                    + "be positive", be1.getMessage());
-        }
-
-        s = new SizeSelector();
-        s.setValue(-10);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector did not check for value being in the "
-                    + "allowable range");
-        } catch (BuildException be2) {
-            assertEquals("The value attribute is required, and must "
-                    + "be positive", be2.getMessage());
-        }
-
-        s = new SizeSelector();
-        Parameter param = new Parameter();
-        param.setName("garbage in");
-        param.setValue("garbage out");
-        Parameter[] params = {param};
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector did not check for valid parameter element");
-        } catch (BuildException be3) {
-            assertEquals("Invalid parameter garbage in", be3.getMessage());
-        }
-
-        s = new SizeSelector();
-        param = new Parameter();
-        param.setName("value");
-        param.setValue("garbage out");
-        params[0] = param;
-        s.setParameters(params);
-        try {
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector accepted bad value as parameter");
-        } catch (BuildException be4) {
-            assertEquals("Invalid size setting garbage out",
-                    be4.getMessage());
-        }
-
-        s = new SizeSelector();
-        Parameter param1 = new Parameter();
-        Parameter param2 = new Parameter();
-        param1.setName("value");
-        param1.setValue("5");
-        param2.setName("units");
-        param2.setValue("garbage out");
-        params = new Parameter[2];
-        params[0] = param1;
-        params[1] = param2;
-        try {
-            s.setParameters(params);
-            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
-            fail("SizeSelector accepted bad units as parameter");
-        } catch (BuildException be5) {
-            assertEquals("garbage out is not a legal value for this attribute",
-                    be5.getMessage());
-        }
-
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        SizeSelector s;
-        String results;
-
-        SizeSelector.ByteUnits kilo = new SizeSelector.ByteUnits();
-        kilo.setValue("K");
-        SizeSelector.ByteUnits kibi = new SizeSelector.ByteUnits();
-        kibi.setValue("Ki");
-        SizeSelector.ByteUnits tibi = new SizeSelector.ByteUnits();
-        tibi.setValue("Ti");
-        SizeSelector.SizeComparisons less = new SizeSelector.SizeComparisons();
-        less.setValue("less");
-        SizeSelector.SizeComparisons equal = new SizeSelector.SizeComparisons();
-        equal.setValue("equal");
-        SizeSelector.SizeComparisons more = new SizeSelector.SizeComparisons();
-        more.setValue("more");
-
-
-    
-        s = new SizeSelector();
-        s.setValue(10);
-        s.setWhen(less);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new SizeSelector();
-        s.setValue(10);
-        s.setWhen(more);
-        results = selectorRule.selectionString(s);
-        assertEquals("TTTTTTTTTTTT", results);
-
-        s = new SizeSelector();
-        s.setValue(32);
-        s.setWhen(equal);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFTFFFFFFT", results);
-
-        s = new SizeSelector();
-        s.setValue(7);
-        s.setWhen(more);
-        s.setUnits(kilo);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFTFFTTTTTTT", results);
-
-        s = new SizeSelector();
-        s.setValue(7);
-        s.setWhen(more);
-        s.setUnits(kibi);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFTFFFTTFTTT", results);
-
-        s = new SizeSelector();
-        s.setValue(99999);
-        s.setWhen(more);
-        s.setUnits(tibi);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new SizeSelector();
-        Parameter param1 = new Parameter();
-        Parameter param2 = new Parameter();
-        Parameter param3 = new Parameter();
-        param1.setName("value");
-        param1.setValue("20");
-        param2.setName("units");
-        param2.setValue("Ki");
-        param3.setName("when");
-        param3.setValue("more");
-        Parameter[] params = {param1,param2,param3};
-        s.setParameters(params);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFTFFTT", results);
-    
-
-    }
-
-    @Test
-    public void testParameterParsingLowerCase() {
-        testCaseInsensitiveParameterParsing("units");
-    }
-
-    @Test
-    public void testParameterParsingUpperCase() {
-        testCaseInsensitiveParameterParsing("UNITS");
-    }
-
-    @Test
-    public void testParameterParsingLowerCaseTurkish() {
-        Locale l = Locale.getDefault();
-        try {
-            Locale.setDefault(new Locale("tr"));
-            testCaseInsensitiveParameterParsing("units");
-        } finally {
-            Locale.setDefault(l);
-        }
-    }
-
-    @Test
-    public void testParameterParsingUpperCaseTurkish() {
-        Locale l = Locale.getDefault();
-        try {
-            Locale.setDefault(new Locale("tr"));
-            testCaseInsensitiveParameterParsing("UNITS");
-        } finally {
-            Locale.setDefault(l);
-        }
-    }
-
-    private void testCaseInsensitiveParameterParsing(String name) {
-        SizeSelector s = new SizeSelector();
-        Parameter p = new Parameter();
-        p.setName(name);
-        p.setValue("foo");
-        try {
-            s.setParameters(new Parameter[] {p});
-            fail("should have caused an exception");
-        } catch (BuildException be) {
-            assertEquals("foo is not a legal value for this attribute",
-                         be.getMessage());
-        }
-    }
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.types.selectors;
+
+import java.util.Locale;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Parameter;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Size Selectors
+ *
+ */
+public class SizeSelectorTest {
+    
+    @Rule
+    public final BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        SizeSelector s = new SizeSelector();
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector did not check for required fields");
+        } catch (BuildException be1) {
+            assertEquals("The value attribute is required, and must "
+                    + "be positive", be1.getMessage());
+        }
+
+        s = new SizeSelector();
+        s.setValue(-10);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector did not check for value being in the "
+                    + "allowable range");
+        } catch (BuildException be2) {
+            assertEquals("The value attribute is required, and must "
+                    + "be positive", be2.getMessage());
+        }
+
+        s = new SizeSelector();
+        Parameter param = new Parameter();
+        param.setName("garbage in");
+        param.setValue("garbage out");
+        Parameter[] params = {param};
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector did not check for valid parameter element");
+        } catch (BuildException be3) {
+            assertEquals("Invalid parameter garbage in", be3.getMessage());
+        }
+
+        s = new SizeSelector();
+        param = new Parameter();
+        param.setName("value");
+        param.setValue("garbage out");
+        params[0] = param;
+        s.setParameters(params);
+        try {
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector accepted bad value as parameter");
+        } catch (BuildException be4) {
+            assertEquals("Invalid size setting garbage out",
+                    be4.getMessage());
+        }
+
+        s = new SizeSelector();
+        Parameter param1 = new Parameter();
+        Parameter param2 = new Parameter();
+        param1.setName("value");
+        param1.setValue("5");
+        param2.setName("units");
+        param2.setValue("garbage out");
+        params = new Parameter[2];
+        params[0] = param1;
+        params[1] = param2;
+        try {
+            s.setParameters(params);
+            s.isSelected(selectorRule.getProject().getBaseDir(), selectorRule.getFilenames()[0],selectorRule.getFiles()[0]);
+            fail("SizeSelector accepted bad units as parameter");
+        } catch (BuildException be5) {
+            assertEquals("garbage out is not a legal value for this attribute",
+                    be5.getMessage());
+        }
+
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        SizeSelector s;
+        String results;
+
+        SizeSelector.ByteUnits kilo = new SizeSelector.ByteUnits();
+        kilo.setValue("K");
+        SizeSelector.ByteUnits kibi = new SizeSelector.ByteUnits();
+        kibi.setValue("Ki");
+        SizeSelector.ByteUnits tibi = new SizeSelector.ByteUnits();
+        tibi.setValue("Ti");
+        SizeSelector.SizeComparisons less = new SizeSelector.SizeComparisons();
+        less.setValue("less");
+        SizeSelector.SizeComparisons equal = new SizeSelector.SizeComparisons();
+        equal.setValue("equal");
+        SizeSelector.SizeComparisons more = new SizeSelector.SizeComparisons();
+        more.setValue("more");
+
+
+    
+        s = new SizeSelector();
+        s.setValue(10);
+        s.setWhen(less);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new SizeSelector();
+        s.setValue(10);
+        s.setWhen(more);
+        results = selectorRule.selectionString(s);
+        assertEquals("TTTTTTTTTTTT", results);
+
+        s = new SizeSelector();
+        s.setValue(32);
+        s.setWhen(equal);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFTFFFFFFT", results);
+
+        s = new SizeSelector();
+        s.setValue(7);
+        s.setWhen(more);
+        s.setUnits(kilo);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFTFFTTTTTTT", results);
+
+        s = new SizeSelector();
+        s.setValue(7);
+        s.setWhen(more);
+        s.setUnits(kibi);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFTFFFTTFTTT", results);
+
+        s = new SizeSelector();
+        s.setValue(99999);
+        s.setWhen(more);
+        s.setUnits(tibi);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new SizeSelector();
+        Parameter param1 = new Parameter();
+        Parameter param2 = new Parameter();
+        Parameter param3 = new Parameter();
+        param1.setName("value");
+        param1.setValue("20");
+        param2.setName("units");
+        param2.setValue("Ki");
+        param3.setName("when");
+        param3.setValue("more");
+        Parameter[] params = {param1,param2,param3};
+        s.setParameters(params);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFTFFTT", results);
+    
+
+    }
+
+    @Test
+    public void testParameterParsingLowerCase() {
+        testCaseInsensitiveParameterParsing("units");
+    }
+
+    @Test
+    public void testParameterParsingUpperCase() {
+        testCaseInsensitiveParameterParsing("UNITS");
+    }
+
+    @Test
+    public void testParameterParsingLowerCaseTurkish() {
+        Locale l = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("tr"));
+            testCaseInsensitiveParameterParsing("units");
+        } finally {
+            Locale.setDefault(l);
+        }
+    }
+
+    @Test
+    public void testParameterParsingUpperCaseTurkish() {
+        Locale l = Locale.getDefault();
+        try {
+            Locale.setDefault(new Locale("tr"));
+            testCaseInsensitiveParameterParsing("UNITS");
+        } finally {
+            Locale.setDefault(l);
+        }
+    }
+
+    private void testCaseInsensitiveParameterParsing(String name) {
+        SizeSelector s = new SizeSelector();
+        Parameter p = new Parameter();
+        p.setName(name);
+        p.setValue("foo");
+        try {
+            s.setParameters(new Parameter[] {p});
+            fail("should have caused an exception");
+        } catch (BuildException be) {
+            assertEquals("foo is not a legal value for this attribute",
+                         be.getMessage());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
index 06e86bd..fb068a3 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java
@@ -1,64 +1,64 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.types.selectors;
-
-import java.io.File;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class TokenizedPatternTest {
-    private static final String DOT_SVN_PATTERN =
-        SelectorUtils.DEEP_TREE_MATCH + File.separator + ".svn"
-        + File.separator + SelectorUtils.DEEP_TREE_MATCH;
-
-    @Test
-    public void testTokenization() {
-        TokenizedPattern pat = new TokenizedPattern(DOT_SVN_PATTERN);
-        assertEquals(3, pat.depth());
-        assertEquals(DOT_SVN_PATTERN, pat.getPattern());
-        assertTrue(pat.containsPattern(SelectorUtils.DEEP_TREE_MATCH));
-        assertTrue(pat.containsPattern(".svn"));
-    }
-
-    @Test
-    public void testEndsWith() {
-        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
-                   .endsWith(SelectorUtils.DEEP_TREE_MATCH));
-    }
-
-    @Test
-    public void testWithoutLastToken() {
-        assertEquals(SelectorUtils.DEEP_TREE_MATCH + File.separatorChar
-                     + ".svn" + File.separator,
-                     new TokenizedPattern(DOT_SVN_PATTERN)
-                     .withoutLastToken().getPattern());
-    }
-
-    @Test
-    public void testMatchPath() {
-        File f = new File(".svn");
-        TokenizedPath p = new TokenizedPath(f.getAbsolutePath());
-        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN).matchPath(p, true));
-        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
-                   .withoutLastToken().matchPath(p, true));
-    }
-
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.types.selectors;
+
+import java.io.File;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TokenizedPatternTest {
+    private static final String DOT_SVN_PATTERN =
+        SelectorUtils.DEEP_TREE_MATCH + File.separator + ".svn"
+        + File.separator + SelectorUtils.DEEP_TREE_MATCH;
+
+    @Test
+    public void testTokenization() {
+        TokenizedPattern pat = new TokenizedPattern(DOT_SVN_PATTERN);
+        assertEquals(3, pat.depth());
+        assertEquals(DOT_SVN_PATTERN, pat.getPattern());
+        assertTrue(pat.containsPattern(SelectorUtils.DEEP_TREE_MATCH));
+        assertTrue(pat.containsPattern(".svn"));
+    }
+
+    @Test
+    public void testEndsWith() {
+        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
+                   .endsWith(SelectorUtils.DEEP_TREE_MATCH));
+    }
+
+    @Test
+    public void testWithoutLastToken() {
+        assertEquals(SelectorUtils.DEEP_TREE_MATCH + File.separatorChar
+                     + ".svn" + File.separator,
+                     new TokenizedPattern(DOT_SVN_PATTERN)
+                     .withoutLastToken().getPattern());
+    }
+
+    @Test
+    public void testMatchPath() {
+        File f = new File(".svn");
+        TokenizedPath p = new TokenizedPath(f.getAbsolutePath());
+        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN).matchPath(p, true));
+        assertTrue(new TokenizedPattern(DOT_SVN_PATTERN)
+                   .withoutLastToken().matchPath(p, true));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/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 2973d2b..777d772 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
@@ -1,81 +1,81 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.types.selectors;
-
-import org.apache.tools.ant.BuildException;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Tests Type Selectors.
- *
- */
-public class TypeSelectorTest {
-
-    @Rule
-    public BaseSelectorRule selectorRule = new BaseSelectorRule();
-
-
-    /**
-     * Test the code that validates the selector.
-     */
-    @Test
-    public void testValidate() {
-        TypeSelector s = new TypeSelector();
-        try {
-            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());
-        }
-    }
-
-    /**
-     * Tests to make sure that the selector is selecting files correctly.
-     */
-    @Test
-    public void testSelectionBehaviour() {
-        TypeSelector s;
-        String results;
-
-        TypeSelector.FileType directory = new TypeSelector.FileType();
-        directory.setValue("dir");
-        TypeSelector.FileType file = new TypeSelector.FileType();
-        file.setValue("file");
-
-    
-
-        s = new TypeSelector();
-        s.setType(directory);
-        results = selectorRule.selectionString(s);
-        assertEquals("TFFFFFFFFFFT", results);
-
-        s = new TypeSelector();
-        s.setType(file);
-        results = selectorRule.selectionString(s);
-        assertEquals("FTTTTTTTTTTF", results);
-
-
-    }
-
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.types.selectors;
+
+import org.apache.tools.ant.BuildException;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests Type Selectors.
+ *
+ */
+public class TypeSelectorTest {
+
+    @Rule
+    public BaseSelectorRule selectorRule = new BaseSelectorRule();
+
+
+    /**
+     * Test the code that validates the selector.
+     */
+    @Test
+    public void testValidate() {
+        TypeSelector s = new TypeSelector();
+        try {
+            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());
+        }
+    }
+
+    /**
+     * Tests to make sure that the selector is selecting files correctly.
+     */
+    @Test
+    public void testSelectionBehaviour() {
+        TypeSelector s;
+        String results;
+
+        TypeSelector.FileType directory = new TypeSelector.FileType();
+        directory.setValue("dir");
+        TypeSelector.FileType file = new TypeSelector.FileType();
+        file.setValue("file");
+
+    
+
+        s = new TypeSelector();
+        s.setType(directory);
+        results = selectorRule.selectionString(s);
+        assertEquals("TFFFFFFFFFFT", results);
+
+        s = new TypeSelector();
+        s.setType(file);
+        results = selectorRule.selectionString(s);
+        assertEquals("FTTTTTTTTTTF", results);
+
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java b/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
index 48a4cbd..22a2739 100644
--- a/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/Base64ConverterTest.java
@@ -1,43 +1,43 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.util;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * TestCase for Base64Converter.
- *
- */
-public class Base64ConverterTest {
-
-    @Test
-    public void testOneValue() {
-        byte[] mybytes = {0, 0, (byte)0xFF};
-        Base64Converter base64Converter = new Base64Converter();
-        assertEquals("AAD/",base64Converter.encode(mybytes));
-    }
-
-    @Test
-    public void testHelloWorld() {
-        byte[] mybytes = "Hello World".getBytes();
-        Base64Converter base64Converter = new Base64Converter();
-        assertEquals("SGVsbG8gV29ybGQ=", base64Converter.encode(mybytes));
-    }
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.util;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * TestCase for Base64Converter.
+ *
+ */
+public class Base64ConverterTest {
+
+    @Test
+    public void testOneValue() {
+        byte[] mybytes = {0, 0, (byte)0xFF};
+        Base64Converter base64Converter = new Base64Converter();
+        assertEquals("AAD/",base64Converter.encode(mybytes));
+    }
+
+    @Test
+    public void testHelloWorld() {
+        byte[] mybytes = "Hello World".getBytes();
+        Base64Converter base64Converter = new Base64Converter();
+        assertEquals("SGVsbG8gV29ybGQ=", base64Converter.encode(mybytes));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
index 3cffa10..4399f91 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
@@ -1,67 +1,67 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.util;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.types.Path;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-
-/**
- * Test case for ClasspathUtils
- *
- */
-public class ClasspathUtilsTest {
-
-    private Project p;
-
-    @Before
-    public void setUp() {
-        p = new Project();
-        p.init();
-    }
-
-
-    @Test
-    public void testOnlyOneInstance() {
-        Enumeration enumeration;
-        String list = "";
-        ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, (Path) null, false);
-        try {
-            enumeration = c.getResources(
-                "org/apache/tools/ant/taskdefs/defaults.properties");
-        } catch (IOException e) {
-            throw new BuildException(
-                "Could not get the defaults.properties resource", e);
-        }
-        int count = 0;
-        while (enumeration.hasMoreElements()) {
-            list = list + " " + enumeration.nextElement();
-            count++;
-        }
-        assertTrue("Should be only one and not " + count + " " + list, count == 1);
-    }
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.util;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Path;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * Test case for ClasspathUtils
+ *
+ */
+public class ClasspathUtilsTest {
+
+    private Project p;
+
+    @Before
+    public void setUp() {
+        p = new Project();
+        p.init();
+    }
+
+
+    @Test
+    public void testOnlyOneInstance() {
+        Enumeration enumeration;
+        String list = "";
+        ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, (Path) null, false);
+        try {
+            enumeration = c.getResources(
+                "org/apache/tools/ant/taskdefs/defaults.properties");
+        } catch (IOException e) {
+            throw new BuildException(
+                "Could not get the defaults.properties resource", e);
+        }
+        int count = 0;
+        while (enumeration.hasMoreElements()) {
+            list = list + " " + enumeration.nextElement();
+            count++;
+        }
+        assertTrue("Should be only one and not " + count + " " + list, count == 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
index 425dc47..5bcbc12 100644
--- a/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
@@ -1,102 +1,102 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.util;
-
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for org.apache.tools.ant.util.CollectionUtils.
- *
- */
-public class CollectionUtilsTest {
-
-
-    @Test
-    public void testVectorEquals() {
-        assertTrue(!CollectionUtils.equals(null, new Vector()));
-        assertTrue(!CollectionUtils.equals(new Vector(), null));
-        assertTrue(CollectionUtils.equals(new Vector(), new Vector()));
-        Vector v1 = new Vector();
-        Stack s2 = new Stack();
-        v1.addElement("foo");
-        s2.push("foo");
-        assertTrue(CollectionUtils.equals(v1, s2));
-        assertTrue(CollectionUtils.equals(s2, v1));
-        v1.addElement("bar");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
-        s2.push("bar");
-        assertTrue(CollectionUtils.equals(v1, s2));
-        assertTrue(CollectionUtils.equals(s2, v1));
-        s2.push("baz");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
-        v1.addElement("baz");
-        assertTrue(CollectionUtils.equals(v1, s2));
-        assertTrue(CollectionUtils.equals(s2, v1));
-        v1.addElement("zyzzy");
-        s2.push("zyzzy2");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
-    }
-
-    @Test
-    public void testDictionaryEquals() {
-        assertTrue(!CollectionUtils.equals(null, new Hashtable()));
-        assertTrue(!CollectionUtils.equals(new Hashtable(), null));
-        assertTrue(CollectionUtils.equals(new Hashtable(), new Properties()));
-        Hashtable h1 = new Hashtable();
-        Properties p2 = new Properties();
-        h1.put("foo", "");
-        p2.put("foo", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        h1.put("bar", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-        p2.put("bar", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        p2.put("baz", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-        h1.put("baz", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        h1.put("zyzzy", "");
-        p2.put("zyzzy2", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-        p2.put("zyzzy", "");
-        h1.put("zyzzy2", "");
-        assertTrue(CollectionUtils.equals(h1, p2));
-        assertTrue(CollectionUtils.equals(p2, h1));
-        h1.put("dada", "1");
-        p2.put("dada", "2");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
-    }
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.util;
+
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Stack;
+import java.util.Vector;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for org.apache.tools.ant.util.CollectionUtils.
+ *
+ */
+public class CollectionUtilsTest {
+
+
+    @Test
+    public void testVectorEquals() {
+        assertTrue(!CollectionUtils.equals(null, new Vector()));
+        assertTrue(!CollectionUtils.equals(new Vector(), null));
+        assertTrue(CollectionUtils.equals(new Vector(), new Vector()));
+        Vector v1 = new Vector();
+        Stack s2 = new Stack();
+        v1.addElement("foo");
+        s2.push("foo");
+        assertTrue(CollectionUtils.equals(v1, s2));
+        assertTrue(CollectionUtils.equals(s2, v1));
+        v1.addElement("bar");
+        assertTrue(!CollectionUtils.equals(v1, s2));
+        assertTrue(!CollectionUtils.equals(s2, v1));
+        s2.push("bar");
+        assertTrue(CollectionUtils.equals(v1, s2));
+        assertTrue(CollectionUtils.equals(s2, v1));
+        s2.push("baz");
+        assertTrue(!CollectionUtils.equals(v1, s2));
+        assertTrue(!CollectionUtils.equals(s2, v1));
+        v1.addElement("baz");
+        assertTrue(CollectionUtils.equals(v1, s2));
+        assertTrue(CollectionUtils.equals(s2, v1));
+        v1.addElement("zyzzy");
+        s2.push("zyzzy2");
+        assertTrue(!CollectionUtils.equals(v1, s2));
+        assertTrue(!CollectionUtils.equals(s2, v1));
+    }
+
+    @Test
+    public void testDictionaryEquals() {
+        assertTrue(!CollectionUtils.equals(null, new Hashtable()));
+        assertTrue(!CollectionUtils.equals(new Hashtable(), null));
+        assertTrue(CollectionUtils.equals(new Hashtable(), new Properties()));
+        Hashtable h1 = new Hashtable();
+        Properties p2 = new Properties();
+        h1.put("foo", "");
+        p2.put("foo", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        h1.put("bar", "");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+        p2.put("bar", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        p2.put("baz", "");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+        h1.put("baz", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        h1.put("zyzzy", "");
+        p2.put("zyzzy2", "");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+        p2.put("zyzzy", "");
+        h1.put("zyzzy2", "");
+        assertTrue(CollectionUtils.equals(h1, p2));
+        assertTrue(CollectionUtils.equals(p2, h1));
+        h1.put("dada", "1");
+        p2.put("dada", "2");
+        assertTrue(!CollectionUtils.equals(h1, p2));
+        assertTrue(!CollectionUtils.equals(p2, h1));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/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..80a8d6b 100644
--- a/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/DOMElementWriterTest.java
@@ -1,305 +1,305 @@
-/*
- *  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.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (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
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  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 org.apache.tools.ant.util;
-
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for org.apache.tools.ant.util.DOMElementWriter.
- *
- */
-public class DOMElementWriterTest {
-
-    private DOMElementWriter w = new DOMElementWriter();
-
-    @Test
-    public void testIsReference() {
-        assertTrue("", w.isReference(""));
-        assertTrue(" ", w.isReference(" "));
-        assertTrue(" ", w.isReference(" "));
-        assertTrue("&#A0;", !w.isReference("&#A0;"));
-        assertTrue("20;", !w.isReference("20;"));
-        assertTrue("&#20", !w.isReference("&#20"));
-        assertTrue(""", w.isReference("""));
-        assertTrue("'", w.isReference("'"));
-        assertTrue(">", w.isReference(">"));
-        assertTrue("<", w.isReference("<"));
-        assertTrue("&", w.isReference("&"));
-    }
-
-    @Test
-    public void testEncode() {
-        assertEquals("", w.encode(""));
-        assertEquals(" ", w.encode(" "));
-        assertEquals(" ", w.encode(" "));
-        assertEquals("&#A0;", w.encode("&#A0;"));
-        assertEquals("20;", w.encode("20;"));
-        assertEquals("&#20", w.encode("&#20"));
-        assertEquals(""", w.encode("""));
-        assertEquals("'", w.encode("'"));
-        assertEquals(">", w.encode(">"));
-        assertEquals("<", w.encode("<"));
-        assertEquals("&", w.encode("&"));
-        assertEquals(""", w.encode("\""));
-        assertEquals("&lt;", w.encode("<"));
-        assertEquals("&amp;", w.encode("&"));
-        assertEquals("", w.encode("\u0017"));
-        assertEquals("\r\n\t", w.encode("\r\n\t"));
-    }
-
-    @Test
-    public void testEncodeAttributeValue() {
-        assertEquals("&amp;#20;", w.encodeAttributeValue("&#20;"));
-        assertEquals("&amp;#x20;", w.encodeAttributeValue("&#x20;"));
-        assertEquals("&amp;#xA0;", w.encodeAttributeValue("&#xA0;"));
-        assertEquals("&amp;#A0;", w.encodeAttributeValue("&#A0;"));
-        assertEquals("20;", w.encodeAttributeValue("20;"));
-        assertEquals("&amp;#20", w.encodeAttributeValue("&#20"));
-        assertEquals("&amp;quot;", w.encodeAttributeValue("&quot;"));
-        assertEquals("&amp;apos;", w.encodeAttributeValue("&apos;"));
-        assertEquals("&amp;gt;", w.encodeAttributeValue("&gt;"));
-        assertEquals("&amp;lt;", w.encodeAttributeValue("&lt;"));
-        assertEquals("&amp;amp;", w.encodeAttributeValue("&amp;"));
-        assertEquals("&quot;", w.encodeAttributeValue("\""));
-        assertEquals("&lt;", w.encodeAttributeValue("<"));
-        assertEquals("&amp;", w.encodeAttributeValue("&"));
-        assertEquals("", w.encodeAttributeValue("\u0017"));
-        assertEquals("&#xd;&#xa;&#x9;", w.encodeAttributeValue("\r\n\t"));
-    }
-
-    @Test
-    public void testAttributeWithWhitespace() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        root.setAttribute("foo", "bar\nbaz");
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root foo=\"bar&#xa;baz\" />" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testEncodeData() {
-        assertEquals("&#20;\"20;&", w.encodedata("&#20;\"20;&"));
-        assertEquals("", w.encodedata("\u0017"));
-    }
-
-    @Test
-    public void testIsLegalCharacter() {
-        assertTrue("0x00", !w.isLegalCharacter('\u0000'));
-        assertTrue("0x09", w.isLegalCharacter('\t'));
-        assertTrue("0x0A", w.isLegalCharacter('\n'));
-        assertTrue("0x0C", w.isLegalCharacter('\r'));
-        assertTrue("0x1F", !w.isLegalCharacter('\u001F'));
-        assertTrue("0x20", w.isLegalCharacter('\u0020'));
-        assertTrue("0xD7FF", w.isLegalCharacter('\uD7FF'));
-        assertTrue("0xD800", !w.isLegalCharacter('\uD800'));
-        assertTrue("0xDFFF", !w.isLegalCharacter('\uDFFF'));
-        assertTrue("0xE000", w.isLegalCharacter('\uE000'));
-        assertTrue("0xFFFD", w.isLegalCharacter('\uFFFD'));
-        assertTrue("0xFFFE", !w.isLegalCharacter('\uFFFE'));
-    }
-
-    @Test
-    public void testCDATAEndEncoding() {
-        assertEquals("]>", w.encodedata("]>"));
-        assertEquals("]]", w.encodedata("]]"));
-        assertEquals("]]]]><![CDATA[>", w.encodedata("]]>"));
-        assertEquals("]]]]><![CDATA[>A", w.encodedata("]]>A"));
-        assertEquals("A]]]]><![CDATA[>", w.encodedata("A]]>"));
-        assertEquals("A]]]]><![CDATA[>A", w.encodedata("A]]>A"));
-        assertEquals("A]]]]><![CDATA[>B]]]]><![CDATA[>C",
-                     w.encodedata("A]]>B]]>C"));
-    }
-
-    @Test
-    public void testNoAdditionalWhiteSpaceForText() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        DOMUtils.appendTextElement(root, "textElement", "content");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root>" + StringUtils.LINE_SEP
-                     + "  <textElement>content</textElement>"
-                     + StringUtils.LINE_SEP
-                     + "</root>" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testNoAdditionalWhiteSpaceForCDATA() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        DOMUtils.appendCDATAElement(root, "cdataElement", "content");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root>" + StringUtils.LINE_SEP
-                     + "  <cdataElement><![CDATA[content]]></cdataElement>"
-                     + StringUtils.LINE_SEP
-                     + "</root>" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testNoAdditionalWhiteSpaceForEmptyElement() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElement("root");
-        DOMUtils.createChildElement(root, "emptyElement");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root>" + StringUtils.LINE_SEP
-                     //                     + "  <emptyElement></emptyElement>"
-                     + "  <emptyElement />"
-                     + StringUtils.LINE_SEP
-                     + "</root>" + StringUtils.LINE_SEP,
-                     sw.toString());
-    }
-
-    @Test
-    public void testNoNSPrefixByDefault() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w = new DOMElementWriter();
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root bar=\"baz\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSOnElement() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .ONLY_QUALIFY_ELEMENTS);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root bar=\"baz\" xmlns=\"urn:foo\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSPrefixOnAttribute() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .QUALIFY_ALL);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root ns0:bar=\"baz\" xmlns=\"urn:foo\""
-                     + " xmlns:ns0=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSPrefixOnAttributeEvenWithoutElement() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        root.setAttributeNS("urn:foo2", "bar", "baz");
-
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            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());
-    }
-
-    @Test
-    public void testNSGetsReused() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        Element child = d.createElementNS("urn:foo", "child");
-        root.appendChild(child);
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .ONLY_QUALIFY_ELEMENTS);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root xmlns=\"urn:foo\">"
-                     + StringUtils.LINE_SEP
-                     + "  <child />"
-                     + StringUtils.LINE_SEP
-                     + "</root>"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-
-    @Test
-    public void testNSGoesOutOfScope() throws IOException {
-        Document d = DOMUtils.newDocument();
-        Element root = d.createElementNS("urn:foo", "root");
-        Element child = d.createElementNS("urn:foo2", "child");
-        root.appendChild(child);
-        Element child2 = d.createElementNS("urn:foo2", "child");
-        root.appendChild(child2);
-        Element grandChild = d.createElementNS("urn:foo2", "grandchild");
-        child2.appendChild(grandChild);
-        Element child3 = d.createElementNS("urn:foo2", "child");
-        root.appendChild(child3);
-        StringWriter sw = new StringWriter();
-        DOMElementWriter w =
-            new DOMElementWriter(false,
-                                 DOMElementWriter.XmlNamespacePolicy
-                                 .ONLY_QUALIFY_ELEMENTS);
-        w.write(root, sw, 0, "  ");
-        assertEquals("<root xmlns=\"urn:foo\">"
-                     + StringUtils.LINE_SEP
-                     + "  <ns0:child xmlns:ns0=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP
-                     + "  <ns1:child xmlns:ns1=\"urn:foo2\">"
-                     + StringUtils.LINE_SEP
-                     + "    <ns1:grandchild />"
-                     + StringUtils.LINE_SEP
-                     + "  </ns1:child>"
-                     + StringUtils.LINE_SEP
-                     + "  <ns2:child xmlns:ns2=\"urn:foo2\" />"
-                     + StringUtils.LINE_SEP
-                      + "</root>"
-                     + StringUtils.LINE_SEP, sw.toString());
-    }
-}
+/*
+ *  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.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (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
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  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 org.apache.tools.ant.util;
+
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for org.apache.tools.ant.util.DOMElementWriter.
+ *
+ */
+public class DOMElementWriterTest {
+
+    private DOMElementWriter w = new DOMElementWriter();
+
+    @Test
+    public void testIsReference() {
+        assertTrue("&#20;", w.isReference("&#20;"));
+        assertTrue("&#x20;", w.isReference("&#x20;"));
+        assertTrue("&#xA0;", w.isReference("&#xA0;"));
+        assertTrue("&#A0;", !w.isReference("&#A0;"));
+        assertTrue("20;", !w.isReference("20;"));
+        assertTrue("&#20", !w.isReference("&#20"));
+        assertTrue("&quot;", w.isReference("&quot;"));
+        assertTrue("&apos;", w.isReference("&apos;"));
+        assertTrue("&gt;", w.isReference("&gt;"));
+        assertTrue("&lt;", w.isReference("&lt;"));
+        assertTrue("&amp;", w.isReference("&amp;"));
+    }
+
+    @Test
+    public void testEncode() {
+        assertEquals("&amp;#20;", w.encode("&#20;"));
+        assertEquals("&amp;#x20;", w.encode("&#x20;"));
+        assertEquals("&amp;#xA0;", w.encode("&#xA0;"));
+        assertEquals("&amp;#A0;", w.encode("&#A0;"));
+        assertEquals("20;", w.encode("20;"));
+        assertEquals("&amp;#20", w.encode("&#20"));
+        assertEquals("&amp;quot;", w.encode("&quot;"));
+        assertEquals("&amp;apos;", w.encode("&apos;"));
+        assertEquals("&amp;gt;", w.encode("&gt;"));
+        assertEquals("&amp;lt;", w.encode("&lt;"));
+        assertEquals("&amp;amp;", w.encode("&amp;"));
+        assertEquals("&quot;", w.encode("\""));
+        assertEquals("&lt;", w.encode("<"));
+        assertEquals("&amp;", w.encode("&"));
+        assertEquals("", w.encode("\u0017"));
+        assertEquals("\r\n\t", w.encode("\r\n\t"));
+    }
+
+    @Test
+    public void testEncodeAttributeValue() {
+        assertEquals("&amp;#20;", w.encodeAttributeValue("&#20;"));
+        assertEquals("&amp;#x20;", w.encodeAttributeValue("&#x20;"));
+        assertEquals("&amp;#xA0;", w.encodeAttributeValue("&#xA0;"));
+        assertEquals("&amp;#A0;", w.encodeAttributeValue("&#A0;"));
+        assertEquals("20;", w.encodeAttributeValue("20;"));
+        assertEquals("&amp;#20", w.encodeAttributeValue("&#20"));
+        assertEquals("&amp;quot;", w.encodeAttributeValue("&quot;"));
+        assertEquals("&amp;apos;", w.encodeAttributeValue("&apos;"));
+        assertEquals("&amp;gt;", w.encodeAttributeValue("&gt;"));
+        assertEquals("&amp;lt;", w.encodeAttributeValue("&lt;"));
+        assertEquals("&amp;amp;", w.encodeAttributeValue("&amp;"));
+        assertEquals("&quot;", w.encodeAttributeValue("\""));
+        assertEquals("&lt;", w.encodeAttributeValue("<"));
+        assertEquals("&amp;", w.encodeAttributeValue("&"));
+        assertEquals("", w.encodeAttributeValue("\u0017"));
+        assertEquals("&#xd;&#xa;&#x9;", w.encodeAttributeValue("\r\n\t"));
+    }
+
+    @Test
+    public void testAttributeWithWhitespace() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        root.setAttribute("foo", "bar\nbaz");
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root foo=\"bar&#xa;baz\" />" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testEncodeData() {
+        assertEquals("&#20;\"20;&", w.encodedata("&#20;\"20;&"));
+        assertEquals("", w.encodedata("\u0017"));
+    }
+
+    @Test
+    public void testIsLegalCharacter() {
+        assertTrue("0x00", !w.isLegalCharacter('\u0000'));
+        assertTrue("0x09", w.isLegalCharacter('\t'));
+        assertTrue("0x0A", w.isLegalCharacter('\n'));
+        assertTrue("0x0C", w.isLegalCharacter('\r'));
+        assertTrue("0x1F", !w.isLegalCharacter('\u001F'));
+        assertTrue("0x20", w.isLegalCharacter('\u0020'));
+        assertTrue("0xD7FF", w.isLegalCharacter('\uD7FF'));
+        assertTrue("0xD800", !w.isLegalCharacter('\uD800'));
+        assertTrue("0xDFFF", !w.isLegalCharacter('\uDFFF'));
+        assertTrue("0xE000", w.isLegalCharacter('\uE000'));
+        assertTrue("0xFFFD", w.isLegalCharacter('\uFFFD'));
+        assertTrue("0xFFFE", !w.isLegalCharacter('\uFFFE'));
+    }
+
+    @Test
+    public void testCDATAEndEncoding() {
+        assertEquals("]>", w.encodedata("]>"));
+        assertEquals("]]", w.encodedata("]]"));
+        assertEquals("]]]]><![CDATA[>", w.encodedata("]]>"));
+        assertEquals("]]]]><![CDATA[>A", w.encodedata("]]>A"));
+        assertEquals("A]]]]><![CDATA[>", w.encodedata("A]]>"));
+        assertEquals("A]]]]><![CDATA[>A", w.encodedata("A]]>A"));
+        assertEquals("A]]]]><![CDATA[>B]]]]><![CDATA[>C",
+                     w.encodedata("A]]>B]]>C"));
+    }
+
+    @Test
+    public void testNoAdditionalWhiteSpaceForText() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        DOMUtils.appendTextElement(root, "textElement", "content");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root>" + StringUtils.LINE_SEP
+                     + "  <textElement>content</textElement>"
+                     + StringUtils.LINE_SEP
+                     + "</root>" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testNoAdditionalWhiteSpaceForCDATA() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        DOMUtils.appendCDATAElement(root, "cdataElement", "content");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root>" + StringUtils.LINE_SEP
+                     + "  <cdataElement><![CDATA[content]]></cdataElement>"
+                     + StringUtils.LINE_SEP
+                     + "</root>" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testNoAdditionalWhiteSpaceForEmptyElement() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElement("root");
+        DOMUtils.createChildElement(root, "emptyElement");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root>" + StringUtils.LINE_SEP
+                     //                     + "  <emptyElement></emptyElement>"
+                     + "  <emptyElement />"
+                     + StringUtils.LINE_SEP
+                     + "</root>" + StringUtils.LINE_SEP,
+                     sw.toString());
+    }
+
+    @Test
+    public void testNoNSPrefixByDefault() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w = new DOMElementWriter();
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root bar=\"baz\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSOnElement() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .ONLY_QUALIFY_ELEMENTS);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root bar=\"baz\" xmlns=\"urn:foo\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSPrefixOnAttribute() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .QUALIFY_ALL);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root ns0:bar=\"baz\" xmlns=\"urn:foo\""
+                     + " xmlns:ns0=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSPrefixOnAttributeEvenWithoutElement() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        root.setAttributeNS("urn:foo2", "bar", "baz");
+
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            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());
+    }
+
+    @Test
+    public void testNSGetsReused() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        Element child = d.createElementNS("urn:foo", "child");
+        root.appendChild(child);
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .ONLY_QUALIFY_ELEMENTS);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root xmlns=\"urn:foo\">"
+                     + StringUtils.LINE_SEP
+                     + "  <child />"
+                     + StringUtils.LINE_SEP
+                     + "</root>"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+
+    @Test
+    public void testNSGoesOutOfScope() throws IOException {
+        Document d = DOMUtils.newDocument();
+        Element root = d.createElementNS("urn:foo", "root");
+        Element child = d.createElementNS("urn:foo2", "child");
+        root.appendChild(child);
+        Element child2 = d.createElementNS("urn:foo2", "child");
+        root.appendChild(child2);
+        Element grandChild = d.createElementNS("urn:foo2", "grandchild");
+        child2.appendChild(grandChild);
+        Element child3 = d.createElementNS("urn:foo2", "child");
+        root.appendChild(child3);
+        StringWriter sw = new StringWriter();
+        DOMElementWriter w =
+            new DOMElementWriter(false,
+                                 DOMElementWriter.XmlNamespacePolicy
+                                 .ONLY_QUALIFY_ELEMENTS);
+        w.write(root, sw, 0, "  ");
+        assertEquals("<root xmlns=\"urn:foo\">"
+                     + StringUtils.LINE_SEP
+                     + "  <ns0:child xmlns:ns0=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP
+                     + "  <ns1:child xmlns:ns1=\"urn:foo2\">"
+                     + StringUtils.LINE_SEP
+                     + "    <ns1:grandchild />"
+                     + StringUtils.LINE_SEP
+                     + "  </ns1:child>"
+                     + StringUtils.LINE_SEP
+                     + "  <ns2:child xmlns:ns2=\"urn:foo2\" />"
+                     + StringUtils.LINE_SEP
+                      + "</root>"
+                     + StringUtils.LINE_SEP, sw.toString());
+    }
+}