net.sourceforge.groboutils.junit.v1.iftc
Interface ImplFactory

All Known Subinterfaces:
ICxFactory
All Known Implementing Classes:
CxFactory

public interface ImplFactory

Allows for tests to be written on interfaces or abstract classes, by creating a specific instance of the interface or abstract class. Test classes will invoke this method to retrieve the specific instance for their tests.

Since October 21, 2002, the createImplObject() method can now throw any exception. Some construction implementations throw all kinds of errors, such as IOException or SQLException. This makes the task of creating factories a bit easier, since we no longer need to worry about proper try/catch blocks.

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

Method Summary
 java.lang.Object createImplObject()
          Create a new instance of the interface type for testing through an InterfaceTest.
 java.lang.String toString()
          All ImplFactory instances should specify a distinguishable name to help in debugging failed tests due to a particular factory's instance setup.
 

Method Detail

createImplObject

public java.lang.Object createImplObject()
                                  throws java.lang.Exception
Create a new instance of the interface type for testing through an InterfaceTest.

As of 21-Oct-2002, this method can raise any exception, and it will be correctly caught and reported as a failure by the InterfaceTestCase.createImplObject() method, so that the creation method can simplify its logic, and add any kind of initialization without having to worry about the correct way to handle exceptions.

Returns:
a new instance of the expected type that the corresponding InterfaceTestCase(s) cover.
Throws:
java.lang.Exception - thrown under any unexpected condition that results in the failure to properly create the instance.
Since:
October 21, 2002: Since this date, this method can now throw exceptions to make creation a bit easier on us.

toString

public java.lang.String toString()
All ImplFactory instances should specify a distinguishable name to help in debugging failed tests due to a particular factory's instance setup.

Returns:
a distinguishable name for the factory.
See Also:
CxFactory: a helper that simplifies this task for us.


Copyright © 2001-2003 by The GroboUtils Project