public final class AbilityDelegatorRegistry extends Object
IAbilityDelegator and IAbilityDelegatorArgs objects registered
during application startup.
The application registers the IAbilityDelegator and IAbilityDelegatorArgs objects when parsing
TestRunner parameters. When writing test cases, you can use this class to obtain the
IAbilityDelegator and IAbilityDelegatorArgs objects of your own application.
IAbilityDelegator can be used to control the lifecycle states of abilities; and IAbilityDelegatorArgs
is used to store all parameters for unit testing.
SystemCapability.Aafwk#ABILITY| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static IAbilityDelegator |
getAbilityDelegator() |
Obtains the
IAbilityDelegator object of the application. |
static IAbilityDelegatorArgs |
getArguments() |
Obtains unit test parameters stored in the
IAbilityDelegatorArgs object. |
static void |
registerInstance(IAbilityDelegator delegator,
IAbilityDelegatorArgs args) |
Registers the instances of classes implementing
IAbilityDelegator and IAbilityDelegatorArgs as
globally unique instances. |
public static IAbilityDelegator getAbilityDelegator()
IAbilityDelegator object of the application.IAbilityDelegator object initialized when the application is started.IllegalStateException - Throws this exception if the application does not need to run unit tests.public static IAbilityDelegatorArgs getArguments()
IAbilityDelegatorArgs object.IAbilityDelegatorArgs object.IllegalStateException - Throws this exception if the application does not need to run unit tests.public static void registerInstance(IAbilityDelegator delegator, IAbilityDelegatorArgs args)
IAbilityDelegator and IAbilityDelegatorArgs as
globally unique instances.
This method is called during application startup to initialize the test environment.
delegator - Indicates the instance of the class implementing IAbilityDelegator.args - Indicates the instance of the class implementing IAbilityDelegatorArgs.