geirm       2002/07/14 15:04:09

  Modified:    src/java/org/apache/velocity/test Tag: VEL_1_3_BRANCH
                        IntrospectorTestCase3.java
  Log:
  Doh.  Need a testbed to test the tests...
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +44 -47    
jakarta-velocity/src/java/org/apache/velocity/test/Attic/IntrospectorTestCase3.java
  
  Index: IntrospectorTestCase3.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/test/Attic/IntrospectorTestCase3.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- IntrospectorTestCase3.java        14 Jul 2002 21:37:06 -0000      1.1.2.1
  +++ IntrospectorTestCase3.java        14 Jul 2002 22:04:09 -0000      1.1.2.2
  @@ -63,6 +63,7 @@
   
   import junit.framework.TestCase;
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
   /**
    *  Simple introspector test case for primitive problem found in 1.3
  @@ -72,11 +73,6 @@
    */
   public class IntrospectorTestCase3 extends BaseTestCase
   {
  -    IntrospectorTestCase3()
  -    {
  -        super("IntrospectorTestCase3");
  -    }
  -
       /**
         * Creates a new instance.
         */
  @@ -87,10 +83,11 @@
   
       public static Test suite()
       {
  -        return new IntrospectorTestCase();
  +        return new TestSuite(IntrospectorTestCase3.class);
       }
   
  -    public void runTest()
  +    public void testSimple()
  +        throws Exception
       {
           Method method;
           String result;
  @@ -98,60 +95,60 @@
   
           MethodProvider mp = new MethodProvider();
   
  -        try
  -        {
  -            /*
  -             * string integer
  -             */
  -
  -            Object[] listIntInt = { new ArrayList(), new Integer(1), new Integer(2) 
};
  -            Object[] intInt = {  new Integer(1), new Integer(2) };
  -            Object[] longInt = {  new Long(1), new Integer(2) };
  -            Object[] longLong = {  new Long(1), new Long(2) };
  +        /*
  +         * string integer
  +         */
   
  -            method = RuntimeSingleton.getIntrospector().getMethod(
  -                MethodProvider.class, "lii", listIntInt);
  -            result = (String) method.invoke(mp, listIntInt);
  +        Object[] listIntInt = { new ArrayList(), new Integer(1), new Integer(2) };
  +        Object[] intInt = {  new Integer(1), new Integer(2) };
  +        Object[] longInt = {  new Long(1), new Integer(2) };
  +        Object[] longLong = {  new Long(1), new Long(2) };
   
  -            assertTrue(result.equals("lii"));
  +        method = RuntimeSingleton.getIntrospector().getMethod(
  +            MethodProvider.class, "lii", listIntInt);
  +        result = (String) method.invoke(mp, listIntInt);
   
  -            method = RuntimeSingleton.getIntrospector().getMethod(
  -                MethodProvider.class, "ii", intInt);
  -            result = (String) method.invoke(mp, intInt);
  +        assertTrue(result.equals("lii"));
   
  -            assertTrue(result.equals("ii"));
  +        method = RuntimeSingleton.getIntrospector().getMethod(
  +            MethodProvider.class, "ii", intInt);
  +        result = (String) method.invoke(mp, intInt);
   
  -            method = RuntimeSingleton.getIntrospector().getMethod(
  -                MethodProvider.class, "ii", longInt);
  -            result = (String) method.invoke(mp, longInt);
  +        assertTrue(result.equals("ii"));
   
  -            assertTrue(result.equals("ii"));
  +        method = RuntimeSingleton.getIntrospector().getMethod(
  +            MethodProvider.class, "ll", longInt);
  +        result = (String) method.invoke(mp, longInt);
   
  -            method = RuntimeSingleton.getIntrospector().getMethod(
  -                MethodProvider.class, "ii", longLong);
  -            result = (String) method.invoke(mp, longLong);
  +        assertTrue(result.equals("ll"));
   
  -            assertTrue(result.equals("ii"));
  +        method = RuntimeSingleton.getIntrospector().getMethod(
  +            MethodProvider.class, "ll", longLong);
  +        result = (String) method.invoke(mp, longLong);
   
  -        }
  -        catch (Exception e)
  -        {
  -            fail( e.toString() );
  -        }
  +        assertTrue(result.equals("ll"));
       }
   
       public static class MethodProvider
       {
  -        public String ii (int p, int d) { return "ii"; }
  -        public String lii (List s, int p, int d) { return "lii"; }
  -    }
  +        public String ii(int p, int d)
  +        {
  +            return "ii";
  +        }
   
  -    public static void main(String[] args)
  -        throws Exception
  -    {
  -        IntrospectorTestCase3 ii = new IntrospectorTestCase3();
  +        public String lii(List s, int p, int d)
  +        {
  +            return "lii";
  +        }
   
  -        ii.runTest();
  +        public String lll(List s, long p, long d)
  +        {
  +            return "lll";
  +        }
  +        public String ll(long p, long d)
  +        {
  +            return "ll";
  +        }
   
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to