org.apache.commons.configuration
Class ConfigurationErrorListenerImpl

java.lang.Object
  extended by org.apache.commons.configuration.ConfigurationErrorListenerImpl
All Implemented Interfaces:
ConfigurationErrorListener

public class ConfigurationErrorListenerImpl
extends Object
implements ConfigurationErrorListener

An implementation of the ConfigurationErrorListener interface that can be used in unit tests. This implementation just records received events and allows to test whether expected errors occurred.

Version:
$Id: ConfigurationErrorListenerImpl.java 1222446 2011-12-22 20:57:32Z oheger $
Author:
Commons Configuration team

Constructor Summary
ConfigurationErrorListenerImpl()
           
 
Method Summary
 void configurationError(ConfigurationErrorEvent event)
          An error event is received.
 int getErrorCount()
          Returns the number of received error events.
 ConfigurationErrorEvent getLastEvent()
          Returns the last received error event.
 void verify()
          Checks whether no error event was received.
 void verify(int type, String propName, Object propValue)
          Checks whether an expected error event was received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationErrorListenerImpl

public ConfigurationErrorListenerImpl()
Method Detail

configurationError

public void configurationError(ConfigurationErrorEvent event)
An error event is received. Updates the internal counter and stores the event.

Specified by:
configurationError in interface ConfigurationErrorListener
Parameters:
event - the error event

getLastEvent

public ConfigurationErrorEvent getLastEvent()
Returns the last received error event.

Returns:
the last error event (may be null)

getErrorCount

public int getErrorCount()
Returns the number of received error events.

Returns:
the number of error events

verify

public void verify()
Checks whether no error event was received.


verify

public void verify(int type,
                   String propName,
                   Object propValue)
Checks whether an expected error event was received. This is a convenience method for checking whether exactly one event of a certain type was received.

Parameters:
type - the type of the event
propName - the name of the property
propValue - the value of the property


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.