| java.lang.Object org.unitils.core.Unitils
Unitils | public class Unitils implements Module(Code) | | Core class of the Unitils library, and the main entry point that gives access to the
TestContext and the
different
Module s.
An instance of Unitils is configured with a certain configuration using the
Unitils.init(Properties) method. Normally,
only one instance of Unitils exists at any time. The default instance can be obtained using the
Unitils.getInstance() method.
This default instance can be set to a custom initialized instance or instance of a custom subclass using
Unitils.setInstance(Unitils) .
If not set, the singleton instance is initialized by default using
Unitils.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 | |
public | Unitils() Creates a new instance. |
Unitils | public Unitils()(Code) | | Creates a new instance.
|
createTestListener | public TestListener createTestListener()(Code) | | Creates a new instance of
TestListener . This instance provides hook callback methods that enable intervening
during the execution of unit tests.
A new instance of TestListener |
getConfiguration | public Properties getConfiguration()(Code) | | Returns all properties that are used to configure unitils and the different modules.
a Properties object |
getInstance | public static synchronized Unitils getInstance()(Code) | | Returns the singleton instance
the singleton instance, not null |
getTestContext | public TestContext getTestContext()(Code) | | 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.
the TestContext |
init | public void init()(Code) | | Initializes unitils with the configuration files.
|
init | public void init(String customConfigurationFileName)(Code) | | Initializes unitils with the given custom configuration file
Parameters: customConfigurationFileName - The name of the custom configuration file |
init | public void init(Properties configuration)(Code) | | Initializes Unitils with the given configuration. All the modules that are configured in the given configuration
are also created and initialized with this configuration.
Parameters: configuration - The config, not null |
initSingletonInstance | public static void initSingletonInstance()(Code) | | Initializes the singleton instance to the default value, loading the configuration using the
ConfigurationLoader |
setInstance | public static void setInstance(Unitils unitils)(Code) | | Sets the singleton instance to the given object
Parameters: unitils - the singleton instance |
|
|