| net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestCase
All known Subclasses: net.sourceforge.groboutils.pmti.v1.autodoc.v1.server.AbstractNewFileServerUTestI, net.sourceforge.groboutils.codecoverage.v2.IClassChannelLogReaderUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.MonitorUTestI, net.sourceforge.groboutils.mbtf.v1.IErrorsUTestI, net.sourceforge.groboutils.pmti.v1.defimpl.AbstractEditableIssueUTestI, net.sourceforge.groboutils.codecoverage.v2.IMethodCodeUTestI, net.sourceforge.groboutils.pmti.v1.defimpl.AbstractEditableAttributeUTestI, net.sourceforge.groboutils.pmti.v1.IEditableAttributeUTestI, net.sourceforge.groboutils.uicapture.v1.IScriptMakerUTestI, net.sourceforge.groboutils.pmti.v1.itf.IIssueRecordUTestI, net.sourceforge.groboutils.codecoverage.v2.datastore.IMetaDataWriterUTestI, net.sourceforge.groboutils.pmti.v1.IIssueUTestI, net.sourceforge.groboutils.pmti.v1.itf.ITestIssueRecordSetUTestI, net.sourceforge.groboutils.pmti.v1.itf.ITestIssueRecordUTestI, net.sourceforge.groboutils.pmti.v1.autodoc.v1.server.AbstractAppendFileServerUTestI, net.sourceforge.groboutils.pmti.v1.itf.parser.IParserGeneratorUTestI, net.sourceforge.groboutils.autodoc.v1.spi.TestListenerFactoryUTestI, net.sourceforge.groboutils.pmti.v1.IAttributeSetUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.TestDataUTestI, net.sourceforge.groboutils.codecoverage.v2.datastore.IClassMetaDataWriterUTestI, net.sourceforge.groboutils.pmti.v1.defimpl.AbstractEditableListAttributeUTestI, net.sourceforge.groboutils.codecoverage.v2.datastore.IClassMetaDataReaderUTestI, net.sourceforge.groboutils.pmti.v1.IEditableIssueStateUTestI, net.sourceforge.groboutils.pmti.v1.autodoc.v1.ITFFactoryUTestI, net.sourceforge.groboutils.pmti.v1.IListAttributeUTestI, net.sourceforge.groboutils.autodoc.v1.AutoDocITUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.AbstractWriterServerUTestI, net.sourceforge.groboutils.pmti.v1.itf.ITestIssueRecordWriterUTestI, net.sourceforge.groboutils.pmti.v1.IProblemManagerInfoUTestI, net.sourceforge.groboutils.junit.v1.iftc.ImplFactoryUTestI, net.sourceforge.groboutils.pmti.v1.itf.parser.IParserUTestI, net.sourceforge.groboutils.codecoverage.v2.IAnalysisMetaDataUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.TestDataFactoryUTestI, net.sourceforge.groboutils.pmti.v1.itf.impl.AbstractTestIssueRecordCollatorUTestI, net.sourceforge.groboutils.pmti.v1.IAttributeUTestI, net.sourceforge.groboutils.junit.v1.iftc.Sample3IUTestI, net.sourceforge.groboutils.junit.v1.iftc.Sample4IUTestI, net.sourceforge.groboutils.autodoc.v1.spi.AutoDocFactoryUTestI, net.sourceforge.groboutils.codecoverage.v2.datastore.IMetaDataReaderUTestI, net.sourceforge.groboutils.pmti.v1.defimpl.AbstractIssueUTestI, net.sourceforge.groboutils.pmti.v1.IAttributeInfoUTestI, net.sourceforge.groboutils.junit.v1.iftc.ICxFactoryUTestI, net.sourceforge.groboutils.pmti.v1.IIssueTypeInfoUTestI, net.sourceforge.groboutils.autodoc.v1.junit.AutoDocJUnitListenerUTestI, net.sourceforge.groboutils.pmti.v1.IEditableListAttributeUTestI, net.sourceforge.groboutils.autodoc.v1.defimpl.IAutoDocSetUTestI, net.sourceforge.groboutils.pmti.v1.itf.ITestIssueRecordCollatorUTestI, net.sourceforge.groboutils.pmti.v1.IProblemManagerUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.ServerUTestI, net.sourceforge.groboutils.util.classes.v1.IUrlClassLoaderOnlineUTestI, net.sourceforge.groboutils.pmti.v1.itf.parser.IParserCollatorUTestI, net.sourceforge.groboutils.autodoc.v1.AutoDocTPUTestI, net.sourceforge.groboutils.junit.v1.iftc.Sample1IUTestI, net.sourceforge.groboutils.codecoverage.v2.IChannelLoggerUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.junit.JUnitTestListenerUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.TestCorrelateUTestI, net.sourceforge.groboutils.pmti.v1.itf.parser.AbstractParserUTestI, net.sourceforge.groboutils.util.classes.v1.IUrlClassLoaderUTestI, net.sourceforge.groboutils.codecoverage.v2.IAnalysisModuleUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.MonitorFinderUTestI, net.sourceforge.groboutils.pmti.v1.IEditableAttributeSetUTestI, net.sourceforge.groboutils.codecoverage.v2.IChannelLogRecordUTestI, net.sourceforge.groboutils.codecoverage.v2.IChannelLogReaderUTestI, net.sourceforge.groboutils.autodoc.v1.AutoDocLogUTestI, net.sourceforge.groboutils.autodoc.v1.testserver.TestInfoUTestI, net.sourceforge.groboutils.autodoc.v1.spi.AutoDocITFactoryUTestI, net.sourceforge.groboutils.pmti.v1.IIssueStateUTestI, net.sourceforge.groboutils.pmti.v1.itf.ITestRecordUTestI, net.sourceforge.groboutils.autodoc.v1.spi.AutoDocTPFactoryUTestI, net.sourceforge.groboutils.autodoc.v1.spi.AutoDocLogFactoryUTestI, net.sourceforge.groboutils.junit.v1.parser.ITestCreatorUTestI, net.sourceforge.groboutils.junit.v1.iftc.Sample2IUTestI, net.sourceforge.groboutils.codecoverage.v2.IChannelLoggerFactoryUTestI, net.sourceforge.groboutils.codecoverage.v2.report.IReportGeneratorUTestI, net.sourceforge.groboutils.pmti.v1.IEditableIssueUTestI, net.sourceforge.groboutils.util.throwable.v1.IChainableExceptionUTestI,
InterfaceTestCase | abstract public class InterfaceTestCase extends TestCase (Code) | | A subclass of TestCase to ease the requirements of creating an
interface test. The tests should be thought of as "contract tests".
Subclasses can call createImplObject() to create a new instance
of a subclass of interfaceClass, which is generated from the
ImplFactory passed into the constructor.
Subclasses that want to use the InterfaceTestSuite helper class will need
to specify a constructor similar to:
public MyClassTest( String name, ImplFactory f )
{
super( name, MyClass.class, f );
}
where MyClass is the interface or base class under test.
As of October 30, 2002, the InterfaceTestCase has a slightly different
behavior when the factory instance is an implementation of ICxFactory.
In this scenario, it will store all the instantiated objects in the stack,
and each instantiated object will be passed to the ICxFactory instance
during the test's normal tearDown. If the ICxFactory throws an exception
during any of the tearDown calls, they will be stored up and reported
in a single exception. Therefore, if you want this functionality, then
you will need to ensure that your tearDown() method calls the
super tearDown().
Even though JUnit 3.8+ allows for a TestCase to have a default (no-arg)
constructor, the InterfaceTestCase does not support this. The
benefits simply aren't there for interface tests: they will still have to
create a constructor which passes InterfaceTestCase which class
is being tested. Since a constructor is required anyway, the little extra
effort to add two arguments to the constructor and call to the super
is trivial compared to not needing the constructor at all.
As of 08-Dec-2002, the returned name of the test can include the class's
name, without the package, to improve traceability. This will allow
the user to be able to see in which specific test class an error occured
through the Ant JUnit report mechanism. This is enabled by default, but
can be disabled by setting the Java system-wide property
"net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestCase.no-classname"
to true,
which is dynamically checked at runtime at each call.
author: Matt Albrecht groboclown@users.sourceforge.net version: $Date: 2003/02/10 22:52:20 $ since: March 2, 2002 See Also: ImplFactory See Also: ICxFactory See Also: InterfaceTestSuite |
Method Summary | |
public Object | createImplObject() Calls the stored factory to create an implemented object. | public Class | getInterfaceClass() Return the interface or abstract class this test covers. | public String | getName() Override the TestCase default getName so that the factory names are
returned as well. | public String | name() Ensure, for JUnit 3.7 support, that the original name() method is
still supported. | public void | setUseClassInName(boolean use) Sets whether the classname is put in the output or not. | protected void | tearDown() Send each instantiated object to the factory for cleanup. |
DONT_USE_CLASSNAME | final static String DONT_USE_CLASSNAME(Code) | | |
InterfaceTestCase | public InterfaceTestCase(String name, Class interfaceClass, ImplFactory f)(Code) | | The standard constructor used by JUnit up to version 3.7.
Parameters: name - the name of the test to execute. Parameters: interfaceClass - the class which this test case tests. Parameters: f - the factory which will create specific subclass instances. |
createImplObject | public Object createImplObject()(Code) | | Calls the stored factory to create an implemented object. Subclasses
should make their own method, say getObject(), which returns
this method's result, but casted to the right class.
This method makes an assertion that the factory's created object is not
null, so that the system state is ensured. Therefore,
this method will never return null. Also, this method asserts
that the created object is of the correct type (as passed in through
the constructor), so that it can be correctly cast without errors.
the object created by the factory. |
getInterfaceClass | public Class getInterfaceClass()(Code) | | Return the interface or abstract class this test covers.
the interface under test. |
getName | public String getName()(Code) | | Override the TestCase default getName so that the factory names are
returned as well.
the method name being tested, along with the factory'sname. |
name | public String name()(Code) | | Ensure, for JUnit 3.7 support, that the original name() method is
still supported.
getName(). |
setUseClassInName | public void setUseClassInName(boolean use)(Code) | | Sets whether the classname is put in the output or not. If you don't
set this value here, it will use the value of the
system property described above.
since: 03-Dec-2002 |
tearDown | protected void tearDown() throws Exception(Code) | | Send each instantiated object to the factory for cleanup.
exception: Exception - thrown if the super's tearDown throws anexception, or if any exceptions are thrown during the tear-downof the factory generated instances. |
|
|