Index: AbstractTestlet.java
===================================================================
RCS file: /home/cvspublic/jakarta-avalon-testlet/src/java/org/apache/testlet/AbstractTestlet.java,v
retrieving revision 1.1
diff -u -r1.1 AbstractTestlet.java
--- AbstractTestlet.java	2001/02/20 00:49:47	1.1
+++ AbstractTestlet.java	2001/06/12 20:18:49
@@ -8,6 +8,8 @@
 package org.apache.testlet;
 
 import java.lang.reflect.Method;
+import java.util.List;
+import java.util.ArrayList;
 
 /**
  * Abstract Base class to extend when creating Tests.
@@ -207,6 +209,34 @@
         return m_name;
     }
 
+    protected String[] getAllTestNames()
+    {
+        final List testNames = new ArrayList();
+
+        final Method methods[] = getClass().getMethods();
+        for( int i = 0; i < methods.length; i++ )
+        {
+            final Class paramTypes[] = methods[i].getParameterTypes();
+
+            if( null != paramTypes && paramTypes.length != 0 ) continue;
+
+            final String methodName = methods[i].getName();
+
+            if( !methodName.startsWith("test") ) continue;
+
+            testNames.add( methodName.substring( 4 ) );
+        }
+        
+        return (String[])testNames.toArray( new String[] {} );
+    }
+
+    protected TestCase createTestCase( final String testName )
+        throws NoSuchMethodException
+    {
+        final Method method = getClass().getMethod( "test" + testName, new Class[] {} );
+        return new DefaultTestCase( testName, method, this );
+    }
+
     public TestSuite getTestSuite() 
     {
         DefaultTestSuite testSuite = null;
@@ -215,20 +245,11 @@
         {
             testSuite = new DefaultTestSuite( m_name );
 
-            final Method methods[] = getClass().getMethods();
+            final String[] testNames = getAllTestNames();
 
-            for( int i = 0; i < methods.length; i++ )
+            for( int i = 0; i < testNames.length; i++ )
             {
-                final Class paramTypes[] = methods[i].getParameterTypes();
-
-                if( null != paramTypes && paramTypes.length != 0 ) continue;
-
-                final String methodName = methods[i].getName();
-
-                if( !methodName.startsWith("test") ) continue;
-
-                final TestCase testCase = 
-                    new DefaultTestCase( methodName.substring(4), methods[i], this );
+                final TestCase testCase = createTestCase( testNames[ i ] );
 
                 testSuite.addTestCase( testCase );
             }

