net.sourceforge.groboutils.junit.v1.parser
Class DelegateTestCreator

java.lang.Object
  extended bynet.sourceforge.groboutils.junit.v1.parser.DelegateTestCreator
All Implemented Interfaces:
ITestCreator

public class DelegateTestCreator
extends java.lang.Object
implements ITestCreator

Allows for an ordered set of TestCreator instances to be queried for generating instances.

Since:
November 4, 2002
Version:
$Date: 2003/02/10 22:52:20 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Constructor Summary
DelegateTestCreator(ITestCreator[] tc)
          Create the delegation with an ordered array of creators.
 
Method Summary
 boolean canCreate(java.lang.Class theClass)
          Checks if the creator can be used on the given class.
 junit.framework.Test createTest(java.lang.Class theClass, java.lang.reflect.Method method)
          Creates a new test, based on the given class and method of the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegateTestCreator

public DelegateTestCreator(ITestCreator[] tc)
Create the delegation with an ordered array of creators. The creators are searched from index 0 to the last index for a valid creator.

Method Detail

canCreate

public boolean canCreate(java.lang.Class theClass)
Checks if the creator can be used on the given class.

Specified by:
canCreate in interface ITestCreator
Parameters:
theClass - the class to check if parsing is acceptable.
Returns:
whether the creator can generate a test based on theClass.

createTest

public junit.framework.Test createTest(java.lang.Class theClass,
                                       java.lang.reflect.Method method)
                                throws java.lang.InstantiationException,
                                       java.lang.NoSuchMethodException,
                                       java.lang.reflect.InvocationTargetException,
                                       java.lang.IllegalAccessException,
                                       java.lang.ClassCastException
Creates a new test, based on the given class and method of the class.

Specified by:
createTest in interface ITestCreator
Parameters:
theClass - the class to parse for testing.
Returns:
the generated test, or null if the test could not be created.
Throws:
java.lang.InstantiationException - if there was a problem creating the class.
java.lang.NoSuchMethodException - if the method does not exist in the class.
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.ClassCastException


Copyright © 2001-2003 by The GroboUtils Project