net.walend.toolkit.junit
class TestSetup

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.extensions.TestDecorator
              |
              +--net.walend.toolkit.junit.TestSetup
All Implemented Interfaces:
Test
Direct Known Subclasses or Subaspects:
TestSetupTest.SomeTestSetup

public abstract class TestSetup
extends junit.extensions.TestDecorator

A Decorator to set up and tear down additional fixture state. Subclass TestSetup and insert it into your tests when you want to set up additional state once before the tests are run.

Unlike TestSetup, this class calls tearDown inside a finally block; tearDown will be called unless there's a real disaster. This change helps insure that all of the setup is unwound after a test. It cleans up resources that live longer than the test in the event of setUp and testing problems.

Author:
David Walend david@walend.net

Inner Class/Aspect Summary
private  class TestSetup.HardenedProtectable
          HardenedProtectable runs the setUp() and basicRun() inside a try block.
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
TestSetup(Test test)
           
 
Method Summary
 void run(TestResult result)
           
protected abstract  void setUp()
          Sets up the fixture.
protected abstract  void tearDown()
          Tears down the fixture.
 
Methods inherited from class junit.extensions.TestDecorator
basicRun, countTestCases, getTest, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

TestSetup

public TestSetup(Test test)
Method Detail

run

public void run(TestResult result)

setUp

protected abstract void setUp()
                       throws java.lang.Exception
Sets up the fixture.

tearDown

protected abstract void tearDown()
                          throws java.lang.Exception
Tears down the fixture.


Copyright (c) 2000, 2001, 2002, David Walend