Annotation Type Injectable
@Mocked
type.
When the type of the injectable is String
, a primitive wrapper, a number type, or an
enum, it is not mocked. A non-empty value()
must then be provided, except in the first case where the
empty string is used by default.
For the duration of each test where the mock field/parameter is in scope, only one injectable instance is mocked; other instances of the same mocked type are not affected. For an injectable mocked class, static methods and constructors are not mocked; only non-native instance methods are.
When used in combination with @Tested, the values of injectable fields and parameters will be used for automatic injection into the tested object. Additionally, this annotation can be applied to non-mocked fields of primitive or array types, which will also be used for injection.
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
String valueSpecifies a literal value when the type of the injectable mock field/parameter isString
, a primitive or wrapper type, a number type, or an enum type. For a primitive/wrapper/number type, the value provided must be convertible to it. For an enum type, the given textual value must equal the name of one of the possible enum values.- Returns:
- the string
- Default:
""
-