net.sourceforge.groboutils.autodoc.v1.junit
Class AutoDocJUnitListener

java.lang.Object
  extended bynet.sourceforge.groboutils.autodoc.v1.junit.AutoDocJUnitListener
All Implemented Interfaces:
junit.framework.TestListener
Direct Known Subclasses:
AutoDocJUnitFormatter

public class AutoDocJUnitListener
extends java.lang.Object
implements junit.framework.TestListener

Listens to JUnit tests, and chains the calls to other listeners. This allows for a central repository to register a listener. This class allows for using the SPI extention mechanism to define delegated-to listeners if no listeners are passed to the constructor.

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

Constructor Summary
AutoDocJUnitListener()
          Create a new listener, using the singleton store to specify all test listener factories.
AutoDocJUnitListener(TestListenerFactory[] factories)
          Create a new listener using the given factories to specify all JUnit listeners.
 
Method Summary
 void addError(junit.framework.Test test, java.lang.Throwable t)
          An error occurred.
 void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)
          A failure occurred.
 void addListener(junit.framework.TestListener tl)
          Add an individual JUnit TestListener to the inner set of listeners.
 void endTest(junit.framework.Test test)
          A test ended.
protected static TestListenerFactory[] getFactories()
          Return all the currently known test listener factories, using the singleton returned by getFactoryStore()
static SPISingletonStore getFactoryStore()
          Retrieve the AutoDocJUnitListenerFactory singleton store for setting up the factory to be used for all unspecified constructor invocations to AutoDocJUnitListener instances.
 java.util.Enumeration getListeners()
          Return a list of all known inner listeners.
protected  void loadListeners(TestListenerFactory factory)
          Creates the listener from the factory, and adds it to the inner list.
 void startTest(junit.framework.Test test)
          A test started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoDocJUnitListener

public AutoDocJUnitListener()
Create a new listener, using the singleton store to specify all test listener factories.


AutoDocJUnitListener

public AutoDocJUnitListener(TestListenerFactory[] factories)
Create a new listener using the given factories to specify all JUnit listeners. If factories is null, then the singleton store will be used to get all factories.

Method Detail

addListener

public void addListener(junit.framework.TestListener tl)
Add an individual JUnit TestListener to the inner set of listeners.

Parameters:
tl - the listener to register. If tl is null, then the request is ignored.

getListeners

public java.util.Enumeration getListeners()
Return a list of all known inner listeners.


addError

public void addError(junit.framework.Test test,
                     java.lang.Throwable t)
An error occurred.

Specified by:
addError in interface junit.framework.TestListener

addFailure

public void addFailure(junit.framework.Test test,
                       junit.framework.AssertionFailedError t)
A failure occurred.

Specified by:
addFailure in interface junit.framework.TestListener

endTest

public void endTest(junit.framework.Test test)
A test ended.

Specified by:
endTest in interface junit.framework.TestListener

startTest

public void startTest(junit.framework.Test test)
A test started.

Specified by:
startTest in interface junit.framework.TestListener

loadListeners

protected void loadListeners(TestListenerFactory factory)
Creates the listener from the factory, and adds it to the inner list.

Parameters:
factory - the factory to create the listener from.
See Also:
addListener( TestListener )

getFactoryStore

public static SPISingletonStore getFactoryStore()
Retrieve the AutoDocJUnitListenerFactory singleton store for setting up the factory to be used for all unspecified constructor invocations to AutoDocJUnitListener instances.


getFactories

protected static TestListenerFactory[] getFactories()
Return all the currently known test listener factories, using the singleton returned by getFactoryStore()



Copyright © 2001-2003 by The GroboUtils Project