You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jk...@apache.org on 2004/12/11 12:21:47 UTC

cvs commit: ant/src/testcases/org/apache/tools/ant IntrospectionHelperTest.java

jkf         2004/12/11 03:21:46

  Modified:    src/testcases/org/apache/tools/ant Tag: ANT_16_BRANCH
                        IntrospectionHelperTest.java
  Log:
  Sync from head
  (needed, test 1.6 branch doesn't build on jdk 1.2.2 otherwise)
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.16.2.7  +22 -11    ant/src/testcases/org/apache/tools/ant/IntrospectionHelperTest.java
  
  Index: IntrospectionHelperTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/IntrospectionHelperTest.java,v
  retrieving revision 1.16.2.6
  retrieving revision 1.16.2.7
  diff -u -r1.16.2.6 -r1.16.2.7
  --- IntrospectionHelperTest.java	23 Aug 2004 13:42:42 -0000	1.16.2.6
  +++ IntrospectionHelperTest.java	11 Dec 2004 11:21:46 -0000	1.16.2.7
  @@ -24,6 +24,7 @@
   import java.lang.reflect.InvocationTargetException;
   import java.util.Collections;
   import java.util.Enumeration;
  +import java.util.HashMap;
   import java.util.Hashtable;
   import java.util.Iterator;
   import java.util.List;
  @@ -593,17 +594,26 @@
   
       public void testGetExtensionPoints() {
           List extensions = ih.getExtensionPoints();
  -        assertEquals("extension count", 3, extensions.size());
  +        final int adders = 2;
  +        assertEquals("extension count", adders, extensions.size());
   
  -        assertExtMethod(extensions.get(0), "add", Number.class,
  -                        new Integer(2), new Integer(3));
  +        // this original test assumed something about the order of
  +        // add(Number) and addConfigured(Map) returned by reflection.
  +        // Unfortunately the assumption doesn't hold for all VMs
  +        // (failed on MacOS X using JDK 1.4.2_05) and the possible
  +        // combinatorics are too hard to check.  We really only want
  +        // to ensure that the more derived Hashtable can be found
  +        // before Map.
  +//        assertExtMethod(extensions.get(0), "add", Number.class,
  +//                        new Integer(2), new Integer(3));
   
           // addConfigured(Hashtable) should come before addConfigured(Map)
  -        assertExtMethod(extensions.get(1), "addConfigured", Hashtable.class,
  +        assertExtMethod(extensions.get(adders - 2),
  +                        "addConfigured", Hashtable.class,
                           makeTable("key", "value"), makeTable("1", "2"));
   
  -        assertExtMethod(extensions.get(2), "addConfigured", Map.class,
  -                        Collections.EMPTY_MAP, makeTable("1", "2"));
  +        assertExtMethod(extensions.get(adders - 1), "addConfigured", Map.class,
  +                        new HashMap(), makeTable("1", "2"));
       }
   
       private void assertExtMethod(Object mo, String methodName, Class methodArg,
  @@ -643,10 +653,11 @@
           return null;
       }
   
  -    public void add(Number n) {
  -        // Valid extension point
  -        assertEquals(2, n.intValue());
  -    }
  +    // see comments in testGetExtensionPoints
  +//    public void add(Number n) {
  +//        // Valid extension point
  +//        assertEquals(2, n.intValue());
  +//    }
   
       public void add(List l, int i) {
           // INVALID extension point
  @@ -654,7 +665,7 @@
   
       public void addConfigured(Map m) {
           // Valid extension point
  -        assertTrue(Collections.EMPTY_MAP == m);
  +        assertTrue(m.size() == 0);
       }
   
       public void addConfigured(Hashtable h) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org