de.bechte.junit.runners.model
Class TestClassPool

java.lang.Object
  extended by de.bechte.junit.runners.model.TestClassPool

public final class TestClassPool
extends Object

This pool of TestClasses is used to reduce the expensive look-ups and reflection calls that are performed during the construction of the TestClass instances. The pool will keep a reference to each instance so that no TestClass has to be constructed twice. Note: The additional memory consumption for keeping the instances is very low, but the pool results in a tremendous speed-up in case of the HierarchicalContextRunner, when TestClasses must be recreated several times along the context hierarchy.


Method Summary
static org.junit.runners.model.TestClass forClass(Class<?> testClass)
          Returns a TestClass wrapping the given testClass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forClass

public static org.junit.runners.model.TestClass forClass(Class<?> testClass)
Returns a TestClass wrapping the given testClass. TestClasses will be shared and held within the pool, to avoid the expensive process that is performed during construction of the instances.

Parameters:
testClass - the Class to create an TestClass instance for
Returns:
the TestClass instance
Throws:
IllegalArgumentException - If testClass is null.


Copyright © 2015. All rights reserved.