dsto.dfc.test
Class LogChecker

java.lang.Object
  extended by dsto.dfc.test.LogChecker
All Implemented Interfaces:
LogListener, EventListener

public class LogChecker
extends Object
implements LogListener

JUnit utility class that listens to DFC log events and logs any errors/warnings and can be used to fail a test if any are logged.

Example:

      protected void setUp ()
      {
        checker = new LogChecker ();
        ...
      }
    
      public void tearDown ()
      {
        checker.assertOk ();
        ...
      }
 

Author:
Matthew Phillips

Constructor Summary
LogChecker()
           
 
Method Summary
 void assertOk()
          If any log errors/warnings have been detected since construction, throw an AssertionFailedError exception.
 void messageReceived(LogEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogChecker

public LogChecker()
Method Detail

messageReceived

public void messageReceived(LogEvent e)
Specified by:
messageReceived in interface LogListener

assertOk

public void assertOk()
              throws junit.framework.AssertionFailedError
If any log errors/warnings have been detected since construction, throw an AssertionFailedError exception. This also disposes of the checker, and should only be called once.

Throws:
junit.framework.AssertionFailedError


Copyright © 2008 Commonwealth of Australia