org.chwf.servlet.mock
Class ReflectingTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.chwf.servlet.mock.ReflectingTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
ServletTestCase

public abstract class ReflectingTestCase
extends junit.framework.TestCase

A test case using reflection to verify that all public methods of a class are tested. It also enforces certain naming conventions on the test class.


Constructor Summary
ReflectingTestCase(java.lang.String name, java.lang.Class testedClass)
          Constructor.
 
Method Summary
 void testWhetherAllMethodsAreTested()
          Ensure that public methods are tested.
 void testWhetherClassAndTestNameMatches()
          Ensure that the test class's fully qualified name is in the form "test.package.TestedClassTest"
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReflectingTestCase

public ReflectingTestCase(java.lang.String name,
                          java.lang.Class testedClass)
Constructor.
Parameters:
name - Test name
testedClass - Tested class. If null, restrictions of the reflecting test case do not apply.
Method Detail

testWhetherAllMethodsAreTested

public void testWhetherAllMethodsAreTested()
Ensure that public methods are tested. Getters and setters may be tested in one test method named testName(), where Name is the tested property.

testWhetherClassAndTestNameMatches

public void testWhetherClassAndTestNameMatches()
Ensure that the test class's fully qualified name is in the form "test.package.TestedClassTest"


Copyright © 2002-2004, Paul Strack. All Rights Reserved.