Package org.camunda.community.mockito
Enum Class Expressions
- All Implemented Interfaces:
Serializable,Comparable<Expressions>,Constable
Util class that delegates to
Mocks.register(String, Object) and
Mocks.get(Object) in a type-safe
way.
When mocking JavaDelegate, ExecutionListener or TaskListener, use
DelegateExpressions instead.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TgetRegistered(Class<?> type) static <T> TgetRegistered(String name) static <T> TregisterInstance(String name, T instance) Delegates toMocks.register(String, Object)static <T> TregisterInstance(T instance) If you already have the instance, register it directly.static voidregisterInstancesForFields(Object instance) Registers mocks viaMocks.register(String, Object)for all attributes with Named-types.static <T> TregisterMockInstance(Class<T> type) Creates a mock for the given type and registers it.static <T> TregisterMockInstance(String name, Class<T> type) Creates a mock for the given type and registers it.static voidregisterMockInstances(Class<?>... types) Creates and registers mock instance for every given type.static voidregisterMockInstances(Collection<Class<?>> types) Creates and registers mock instance for every given type.static voidregisterMockInstancesForNestedTypes(Class<?> parentClass) Registers mock instances for every public static nested class found in parentClass.static <T> TregisterNewInstance(Class<T> type) Creates a new instance for the given type using the default constructor and registers it.static <T> TregisterNewInstance(String name, Class<T> type) Creates a new instance for the given type and registers it under the given name.static voidregisterNewInstancesForNestedTypes(Class<?> parentClass) Registers new instances for every public static nested class found in parentClass.static voidreset()static ExpressionsReturns the enum constant of this class with the specified name.static Expressions[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
registerMockInstancesForNestedTypes
Registers mock instances for every public static nested class found in parentClass.- Parameters:
parentClass- the parentClass to scan for nested public static types
-
registerInstancesForFields
Registers mocks viaMocks.register(String, Object)for all attributes with Named-types.- Parameters:
instance- instance who's fields are registered (maybe Junit test or jbehave steps).
-
registerNewInstancesForNestedTypes
Registers new instances for every public static nested class found in parentClass.- Parameters:
parentClass- the parentClass to scan for nested public static types
-
registerMockInstances
Creates and registers mock instance for every given type.- Parameters:
types- collection of types to mock and register- See Also:
-
registerMockInstances
Creates and registers mock instance for every given type.- Parameters:
types- collection of types to mock and register
-
registerMockInstance
Creates a mock for the given type and registers it.- Parameters:
name- the juel name under which the mock is registeredtype- the type of the mock to create- Returns:
- the registered mock instance
-
registerMockInstance
Creates a mock for the given type and registers it.- Parameters:
type- the type of the mock to create- Returns:
- the registered mock instance
-
registerNewInstance
Creates a new instance for the given type and registers it under the given name.- Parameters:
name- the name for the registered instancetype- the type of the instance to create- Returns:
- the registered instance
-
registerNewInstance
Creates a new instance for the given type using the default constructor and registers it.- Parameters:
type- the type of the instance to create- Returns:
- the registered instance
- See Also:
-
registerInstance
public static <T> T registerInstance(T instance) If you already have the instance, register it directly. Name is guessed viaNameForType.- Parameters:
instance- the instance or mock to register- Returns:
- the registered instance
-
registerInstance
Delegates toMocks.register(String, Object)- Parameters:
name- the juel name for the registered instanceinstance- the instance to register- Returns:
- the registered instance
-
getRegistered
- Parameters:
name- juel name of the registered instance or mock- Returns:
- registered instance or mock of type
-
getRegistered
- Parameters:
type- the type of the registered instance or mock- Returns:
- registered instance or mock for type
-
reset
public static void reset()- See Also:
-
Mocks.reset()
-