Top Inners Constructors Methods
org.glassfish.pfl.test

public Class TestCaseTools

extends Object
Class Inheritance
Imports
java.io.PrintStream, .PrintWriter, .StringWriter, java.lang.reflect.Constructor, .InvocationTargetException, .Method, .Modifier, java.util.Enumeration, .List, .Vector, junit.framework.Test, .TestCase, .TestResult, .TestSuite

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TestCaseTools.SingleInstanceTestSuite

This is a special version of TestSuite that fixes, once and for all, the irritating design of JUnit to invoke the constructor multiple times on a test class.

public static enum

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static String
getSuffix(char ch, String str)

public static TestSuite
makeTestSuite(Class<T> cls)

Method to create a collection of nested TestSuites out of nested classes.

public static TestSuite
private static String
public static void
reportTiming(int repCount, PrintStream out, List<TimedTest> timedTests)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TestCaseToolsback to summary
public TestCaseTools()

Method Detail

getSuffixback to summary
private static String getSuffix(char ch, String str)
makeTestSuiteback to summary
public static TestSuite makeTestSuite(Class<T> cls)

Method to create a collection of nested TestSuites out of nested classes. Can either create standard JUnit TestSuites, or SingleInstanceTestSuites.

makeTestSuiteback to summary
public static TestSuite makeTestSuite(Class<T> cls, TestCaseTools.TestSuiteType type)
makeTestSuiteNameback to summary
private static String makeTestSuiteName(Class<T> cls)
reportTimingback to summary
public static void reportTiming(int repCount, PrintStream out, List<TimedTest> timedTests)
org.glassfish.pfl.test back to summary

public Class TestCaseTools.SingleInstanceTestSuite

extends TestSuite
Class Inheritance

This is a special version of TestSuite that fixes, once and for all, the irritating design of JUnit to invoke the constructor multiple times on a test class. This operates as follows: construct an instance of the test class in inst try { for each test method method.invoke( inst ) ; } catch ... { } finally { invoke post method (if any) }

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
TestCaseTools.SingleInstanceTestSuite.SingleInstanceTestCase

References Deprecated TestCase is deprecated or references (maybe indirectly) at least one deprecated element.
A simple variant of JUnit's TestCase that invokes the test method on the supplied test.

Field Summary

Modifier and TypeField and Description
private Method
private Method
private Method
private Test

Constructor Summary

AccessConstructor and Description
public
SingleInstanceTestSuite(final Class<T> theClass)

Method Summary

Modifier and TypeMethod and Description
private void
addTestMethod(Method m, Vector<E> names, Test test)

private Test
doWarning(final String message)

private String
private Method
getMethod(Class<T> theClass, String name)

private boolean
private boolean
public void
run(TestResult result)

Overrides junit.framework.TestSuite.run.

Implements junit.framework.Test.run.

Runs the tests and collects their result in a TestResult.

public void
Inherited from junit.framework.TestSuite:
addTestaddTestSuitecountTestCasescreateTestgetNamegetTestConstructorsetNametestAttestCountteststoStringwarning

Field Detail

postMethodback to summary
private Method postMethod
setUpMethodback to summary
private Method setUpMethod
tearDownMethodback to summary
private Method tearDownMethod
testback to summary
private Test test

Constructor Detail

SingleInstanceTestSuiteback to summary
public SingleInstanceTestSuite(final Class<T> theClass)

Method Detail

addTestMethodback to summary
private void addTestMethod(Method m, Vector<E> names, Test test)
doWarningback to summary
private Test doWarning(final String message)
exceptionToStringback to summary
private String exceptionToString(Throwable t)
getMethodback to summary
private Method getMethod(Class<T> theClass, String name)
isPublicTestMethodback to summary
private boolean isPublicTestMethod(Method m)

Hides junit.framework.TestSuite.isPublicTestMethod.

isTestMethodback to summary
private boolean isTestMethod(Method m)

Hides junit.framework.TestSuite.isTestMethod.

runback to summary
public void run(TestResult result)

Overrides junit.framework.TestSuite.run.

Implements junit.framework.Test.run.

Doc from junit.framework.TestSuite.run.

Runs the tests and collects their result in a TestResult.

runTestback to summary
public void runTest(Test test, TestResult result)

Overrides junit.framework.TestSuite.runTest.

org.glassfish.pfl.test back to summary

private Class TestCaseTools.SingleInstanceTestSuite.SingleInstanceTestCase

extends TestCase
Class Inheritance

References Deprecated

TestCase is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

A simple variant of JUnit's TestCase that invokes the test method on the supplied test. This allows creating multiple TestCases that share the same instance.

Field Summary

Modifier and TypeField and Description
private Method

Constructor Summary

AccessConstructor and Description
public

Field Detail

runMethodback to summary
private Method runMethod

Constructor Detail

SingleInstanceTestCaseback to summary
public SingleInstanceTestCase(Method runMethod)

Method Detail

runTestback to summary
protected void runTest() throws Throwable

Overrides junit.framework.TestCase.runTest.

Doc from junit.framework.TestCase.runTest.

Override to run the test and assert its state.

Exceptions
Throwable:
if any exception is thrown
setUpback to summary
protected void setUp()

Overrides junit.framework.TestCase.setUp.

Doc from junit.framework.TestCase.setUp.

Sets up the fixture, for example, open a network connection. This method is called before a test is executed.

tearDownback to summary
protected void tearDown()

Overrides junit.framework.TestCase.tearDown.

Doc from junit.framework.TestCase.tearDown.

Tears down the fixture, for example, close a network connection. This method is called after a test is executed.

org.glassfish.pfl.test back to summary

public final Enum TestCaseTools.TestSuiteType

extends Enum<TestCaseTools.TestSuiteType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TestCaseTools.TestSuiteType
public static final TestCaseTools.TestSuiteType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TestCaseTools.TestSuiteType
public static TestCaseTools.TestSuiteType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

SINGLEback to summary
public static final TestCaseTools.TestSuiteType SINGLE
STANDARDback to summary
public static final TestCaseTools.TestSuiteType STANDARD

Constructor Detail

TestSuiteTypeback to summary
private TestSuiteType()

Method Detail

valueOfback to summary
public static TestCaseTools.TestSuiteType valueOf(String name)
valuesback to summary
public static TestCaseTools.TestSuiteType[] values()