commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test ProviderTestSuite.java
Date Mon, 25 Nov 2002 05:46:03 GMT
adammurdoch    2002/11/24 21:46:03

  Modified:    vfs/src/test/org/apache/commons/vfs/test
                        ProviderTestSuite.java
  Log:
  Allow extra tests to be added to a provider test suite.
  
  Revision  Changes    Path
  1.5       +16 -9     jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/ProviderTestSuite.java
  
  Index: ProviderTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/ProviderTestSuite.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProviderTestSuite.java	23 Nov 2002 00:41:10 -0000	1.4
  +++ ProviderTestSuite.java	25 Nov 2002 05:46:03 -0000	1.5
  @@ -101,19 +101,26 @@
        */
       private void addBaseTests() throws Exception
       {
  -        addTestClass( ProviderReadTests.class );
  -        addTestClass( ProviderWriteTests.class );
  -        addTestClass( UrlTests.class );
  -        addTestClass( VfsClassLoaderTests.class );
  +        addTests( ProviderReadTests.class );
  +        addTests( ProviderWriteTests.class );
  +        addTests( UrlTests.class );
  +        addTests( VfsClassLoaderTests.class );
       }
   
       /**
  -     * Adds the tests from a class to this suite.  Looks for a no-args constructor
  -     * which it uses to create instances of the test class.  Adds an instance
  -     * for each public test method provided by the class.
  +     * Adds the tests from a class to this suite.  The supplied class must be
  +     * a subclass of {@link AbstractProviderTestCase} and have a public a
  +     * no-args constructor.  This method creates an instance of the supplied
  +     * class for each public 'testNnnn' method provided by the class.
        */
  -    private void addTestClass( final Class testClass ) throws Exception
  +    public void addTests( final Class testClass ) throws Exception
       {
  +        // Verify the class
  +        if ( !AbstractProviderTestCase.class.isAssignableFrom( testClass ) )
  +        {
  +            throw new Exception( "Test class " + testClass.getName() + " is not assignable
to " + AbstractProviderTestCase.class.getName() );
  +        }
  +
           // Locate the test methods
           final Method[] methods = testClass.getMethods();
           for ( int i = 0; i < methods.length; i++ )
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message