|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.core.Unitils
public class Unitils
Core class of the Unitils library, and the main entry point that gives access to the TestContext
and the
different Module
s.
init(Properties)
method. Normally,
only one instance of Unitils exists at any time. The default instance can be obtained using the getInstance()
method.
This default instance can be set to a custom initialized instance or instance of a custom subclass using
setInstance(Unitils)
.
If not set, the singleton instance is initialized by default using initSingletonInstance()
. This method uses
the ConfigurationLoader
to load the configuration. An instance of ModulesRepository
is used to
initialize and maintain the modules.
Unitils itself is also implemented as a module. In fact, an instance of Unitils behaves like a module who's behaviour
is defined by the added behaviour of all modules.
Constructor Summary | |
---|---|
Unitils()
Creates a new instance. |
Method Summary | |
---|---|
protected void |
afterInitModules()
Gives all modules the opportunity to performs initialization that can only work after all other modules have been initialized |
protected ModulesRepository |
createModulesRepository(Properties configuration)
Configures all unitils modules using the given Properties object, and stores them in a ModulesRepository . |
Properties |
getConfiguration()
Returns all properties that are used to configure unitils and the different modules. |
static Unitils |
getInstance()
Returns the singleton instance |
ModulesRepository |
getModulesRepository()
Returns the ModulesRepository that provides access to the modules that are configured in unitils. |
TestContext |
getTestContext()
Returns the TestContext that, during the execution of the test suite, keeps track of the current test
object, class and test method that are executing. |
TestListener |
getTestListener()
Returns the single instance of TestListener . |
void |
init()
Initializes unitils with the configuration files. |
void |
init(Properties configuration)
Initializes Unitils with the given configuration. |
static void |
initSingletonInstance()
Initializes the singleton instance to the default value, loading the configuration using the ConfigurationLoader |
protected boolean |
isClassAvailable(String className)
Utility method that verifies whether the class with the given fully qualified classname is available in the classpath. |
static void |
setInstance(Unitils unitils)
Sets the singleton instance to the given object |
protected void |
verifyPackaging(Properties configuration)
Verifies that we're not working with a distribution that includes the necessary classes from spring, while spring is in the classpath anyway. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Unitils()
Method Detail |
---|
public static Unitils getInstance()
public static void setInstance(Unitils unitils)
unitils
- the singleton instancepublic static void initSingletonInstance()
ConfigurationLoader
public void init()
public void init(Properties configuration)
configuration
- The config, not nullprotected void afterInitModules()
protected void verifyPackaging(Properties configuration)
configuration
- The configurationprotected boolean isClassAvailable(String className)
className
- The name of the class
public TestListener getTestListener()
TestListener
. This instance provides hook callback methods that enable intervening
during the execution of unit tests.
TestListener
public ModulesRepository getModulesRepository()
ModulesRepository
that provides access to the modules that are configured in unitils.
ModulesRepository
public TestContext getTestContext()
TestContext
that, during the execution of the test suite, keeps track of the current test
object, class and test method that are executing.
TestContext
public Properties getConfiguration()
Properties
objectprotected ModulesRepository createModulesRepository(Properties configuration)
Properties
object, and stores them in a ModulesRepository
. The configuration of the modules is delegated to a ModulesLoader
instance.
configuration
- The config, not null
ModulesRepository
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |