Enum Class MockReset
- All Implemented Interfaces:
Serializable
,Comparable<MockReset>
,Constable
Reset strategy used on a mock bean. Usually applied to a mock through the
@MockitoBean
annotation but can also be directly applied
to any mock in the ApplicationContext
using the static methods.- Since:
- 6.2
- Author:
- Phillip Webb
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic org.mockito.MockSettings
after()
Createsettings
to be used with mocks where reset should occur after each test method runs.static org.mockito.MockSettings
ApplyMockReset
to existingsettings
.static org.mockito.MockSettings
before()
Createsettings
to be used with mocks where reset should occur before each test method runs.static MockReset
Returns the enum constant of this class with the specified name.static MockReset[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.static org.mockito.MockSettings
withSettings
(MockReset reset) Createsettings
to be used with mocks where a specific reset should occur.
-
Enum Constant Details
-
BEFORE
Reset the mock before the test method runs. -
AFTER
Reset the mock after the test method runs. -
NONE
Don't reset the mock.
-
-
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
-
before
public static org.mockito.MockSettings before()Createsettings
to be used with mocks where reset should occur before each test method runs.- Returns:
- mock settings
-
after
public static org.mockito.MockSettings after()Createsettings
to be used with mocks where reset should occur after each test method runs.- Returns:
- mock settings
-
withSettings
Createsettings
to be used with mocks where a specific reset should occur.- Parameters:
reset
- the reset type- Returns:
- mock settings
-
apply
ApplyMockReset
to existingsettings
.- Parameters:
reset
- the reset typesettings
- the settings- Returns:
- the configured settings
-