org.jcoderz.commons
Class TestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.jcoderz.commons.TestCase
All Implemented Interfaces:
Test
Direct Known Subclasses:
FormatTest, HttpClientConnectionTest, HttpConnectorBeanTest, LogMessageGeneratorTest, LogViewerTest, ServerTestCase, SimpleTypeGeneratorTest, SqlTransformerTest, WhitespaceFormatTest

public abstract class TestCase
extends TestCase

Base class for a JUnit test that provides additional utility methods.

Author:
Michael Griffel

Constructor Summary
TestCase()
          Default constructor.
TestCase(String name)
          Constructs a TestCase with the given name.
 
Method Summary
static File getBaseDir()
          Returns the projects base directory.
static String getHostName()
          Returns the hostname of localhost.
static TestSuite getSuite(Class testClass)
          Create a TestSuite using the TestCase subclass and the list of test cases to run specified using the TEST_CASES JVM property.
static boolean hasTestCases()
          Check to see if the test cases property is set.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestCase

public TestCase()
Default constructor.


TestCase

public TestCase(String name)
Constructs a TestCase with the given name.

Parameters:
name - The test case name.
Method Detail

getBaseDir

public static File getBaseDir()
Returns the projects base directory.

Returns:
the projects base directory.

getHostName

public static String getHostName()
Returns the hostname of localhost.

Returns:
String the hostname of localhost.

hasTestCases

public static boolean hasTestCases()
Check to see if the test cases property is set. Ignores Ant's default setting for the property (or null to be on the safe side).

Returns:
boolean true if the test case property is set, false else

getSuite

public static TestSuite getSuite(Class testClass)
                          throws RuntimeException,
                                 IllegalArgumentException
Create a TestSuite using the TestCase subclass and the list of test cases to run specified using the TEST_CASES JVM property.

Parameters:
testClass - the TestCase subclass to instantiate as tests in the suite.
Returns:
a TestSuite with new instances of testClass for each test case specified in the JVM property.
Throws:
IllegalArgumentException - if testClass is not a subclass or implementation of junit.framework.TestCase.
RuntimeException - if testClass is written incorrectly and does not have the approriate constructor.


Copyright 2007 The jCoderZ Project.