net.sourceforge.groboutils.junit.v1
Class TestMonitorRunnable

java.lang.Object
  extended byjunit.framework.Assert
      extended bynet.sourceforge.groboutils.junit.v1.TestRunnable
          extended bynet.sourceforge.groboutils.junit.v1.TestMonitorRunnable
All Implemented Interfaces:
java.lang.Runnable

public abstract class TestMonitorRunnable
extends TestRunnable

A helper class to more easily create monitors. TestRunnable monitors do not have to extend this class, but it helps in becoming more conformant to the requirements of the superclass.

Since:
July 12, 2003
Version:
$Date: 2003/09/29 21:09:40 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Field Summary
 
Fields inherited from class net.sourceforge.groboutils.junit.v1.TestRunnable
LOG
 
Constructor Summary
TestMonitorRunnable()
           
 
Method Summary
abstract  void runMonitor()
          Performs checks on the monitored object which is being subjected to parallel processing.
 void runTest()
          Performs all the necessary looping, end-of-threads, and interrupt checking.
protected  void yieldProcessing()
          Instructs the thread to pause for a while.
 
Methods inherited from class net.sourceforge.groboutils.junit.v1.TestRunnable
delay, isDone, run
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestMonitorRunnable

public TestMonitorRunnable()
Method Detail

runMonitor

public abstract void runMonitor()
                         throws java.lang.Throwable
Performs checks on the monitored object which is being subjected to parallel processing. This method should not perform looping over the check(s), since the runTest() method will perform these.

Throws:
java.lang.Throwable - any exception may be thrown and will be reported as a test failure, except for InterruptedExceptions, which will be ignored.

runTest

public void runTest()
             throws java.lang.Throwable
Performs all the necessary looping, end-of-threads, and interrupt checking. The inner loop calls the runMonitor() method.

Specified by:
runTest in class TestRunnable
Throws:
java.lang.Throwable - any exception may be thrown and will be reported as a test failure, except for InterruptedExceptions, which will be ignored.

yieldProcessing

protected void yieldProcessing()
                        throws java.lang.InterruptedException
Instructs the thread to pause for a while. This method is called by the runTest() method's loop, immediately after each runMonitor() invocation. The default implementation performs a Thread.yield() call, but by putting it into this method, that behavior can be modified.

Throws:
java.lang.InterruptedException - allows for overloading methods to perform a delay( long ) call within their implementation.


Copyright © 2001-2003 by The GroboUtils Project