test for https://bz.apache.org/bugzilla/show_bug.cgi?id=61042


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/2ec41afd
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/2ec41afd
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/2ec41afd

Branch: refs/heads/master
Commit: 2ec41afdcae5bd5346f0b840a1a3c9e467220915
Parents: 9b123a8
Author: Stefan Bodewig <[email protected]>
Authored: Fri Apr 28 16:34:20 2017 +0200
Committer: Stefan Bodewig <[email protected]>
Committed: Fri Apr 28 16:34:20 2017 +0200

----------------------------------------------------------------------
 WHATSNEW                                           |  4 ++++
 .../apache/tools/ant/IntrospectionHelperTest.java  | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/2ec41afd/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 93cce38..b552951 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -31,6 +31,10 @@ Other changes:
  * reduced GC pressure by replacing all usage of FileInputStream and
    FileOutputStream.
 
+ * Task can now also use attribute setters that expect a
+   java.nio.file.Path argument.
+   Bugzilla Report 61042
+
 Changes from Ant 1.10.0 TO Ant 1.10.1
 =====================================
 

http://git-wip-us.apache.org/repos/asf/ant/blob/2ec41afd/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java 
b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
index ca4085d..424fb8e 100644
--- a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
@@ -21,6 +21,8 @@ package org.apache.tools.ant;
 import java.io.File;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -466,6 +468,7 @@ public class IntrospectionHelperTest {
         attrMap.put("seventeen", Byte.TYPE);
         attrMap.put("eightteen", Short.TYPE);
         attrMap.put("nineteen", Double.TYPE);
+        attrMap.put("twenty", Path.class);
 
         /*
          * JUnit 3.7 adds a getName method to TestCase - so we now
@@ -546,6 +549,8 @@ public class IntrospectionHelperTest {
                          new Short((short)18), new Short((short)10));
         assertAttrMethod("nineteen", "setNineteen", Double.TYPE,
                          new Double(19), new Double((short)10));
+        assertAttrMethod("twenty", "setTwenty", Path.class,
+                         new File(projectBasedir + 20).toPath(), 
Paths.get("toto"));
 
         try {
             assertAttrMethod("onehundred", null, null, null, null);
@@ -634,6 +639,18 @@ public class IntrospectionHelperTest {
         assertTrue("Expected 19, received " + d, diff > -1e-6 && diff < 1e-6);
     }
 
+    public void setTwenty(Path p) {
+        String path = p.toAbsolutePath().toString();
+        if (Os.isFamily("unix") || Os.isFamily("openvms")) {
+            assertEquals(projectBasedir+"20", path);
+        } else if (Os.isFamily("netware")) {
+            assertEquals(projectBasedir+"20", path.toLowerCase(Locale.US));
+        } else {
+            assertEquals(":"+projectBasedir+"20",
+                         path.toLowerCase(Locale.US).substring(1));
+        }
+    }
+
     @Test
     public void testGetExtensionPoints() {
         List extensions = ih.getExtensionPoints();

Reply via email to