public enum Answers extends Enum<Answers>
You can use it to pass extra parameters to @Mock annotation, see more info here: Mock
Example:
@Mock(answer = RETURNS_DEEP_STUBS) UserProvider userProvider;This is not the full list of Answers available in Mockito. Some interesting answers can be found in org.mockito.stubbing.answers package.
Enum Constant and Description |
---|
CALLS_REAL_METHODS |
RETURNS_DEEP_STUBS |
RETURNS_DEFAULTS |
RETURNS_MOCKS |
RETURNS_SMART_NULLS |
Modifier and Type | Method and Description |
---|---|
Answer<Object> |
get() |
static Answers |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Answers[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Answers RETURNS_DEFAULTS
public static final Answers RETURNS_SMART_NULLS
public static final Answers RETURNS_MOCKS
public static final Answers RETURNS_DEEP_STUBS
public static final Answers CALLS_REAL_METHODS
public static Answers[] values()
for (Answers c : Answers.values()) System.out.println(c);
public static Answers valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2018. All rights reserved.