com.marringtons.util
Class TestCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.marringtons.util.TestCase
All Implemented Interfaces:
junit.framework.Test

public class TestCase
extends junit.framework.TestCase

When using junit, use this class as a wrapper around the junit version to provide additional functionality.

Author:
Paul Marrington

Constructor Summary
TestCase()
          Default constructer - used when calling test cases directly.
TestCase(String testName)
          Constructor with package name
 
Method Summary
 void check(boolean test)
          A simpler and more readable way of saying assertTrue();
 void check(boolean test, Object message)
          A simpler and more readable way of saying assertTrue();
 void garbageCollect()
          When testing it is sometimes necessary to garbage collect
 int random(int range)
          Retrieve a random number given a minimum value and a range.
 int random(int from, int range)
          Retrieve a random number given a minimum value and a range.
 void testTest()
          Empty test in case this is picked up by test suite
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, toString
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestCase

public TestCase()
Default constructer - used when calling test cases directly.


TestCase

public TestCase(String testName)
Constructor with package name

Parameters:
testName - name of the test case being run.
Method Detail

garbageCollect

public void garbageCollect()
When testing it is sometimes necessary to garbage collect


check

public void check(boolean test)
A simpler and more readable way of saying assertTrue();

Parameters:
test - false causes a junit exception to be logged.

check

public void check(boolean test,
                  Object message)
A simpler and more readable way of saying assertTrue();

Parameters:
test - false causes a junit exception to be logged.
message - Message to display if test failed.

random

public int random(int from,
                  int range)
Retrieve a random number given a minimum value and a range.
 afternoonHour = random( 12, 12);
 

Parameters:
from - Base value (can be returned)
range - Range above base possible (but not including range)
Returns:
Random from 'from' (inclusive) to 'range' (exclusive).

random

public int random(int range)
Retrieve a random number given a minimum value and a range.
 hour = random( 24); // returns 0 to 23
 

Parameters:
range - Range above base possible (but not including range)
Returns:
Random from 'from' (inclusive) to 'range' (exclusive).

testTest

public void testTest()
Empty test in case this is picked up by test suite



Copyright © 2005 Paul Marrington http://library.marringtons.com