Enum MockReset
- java.lang.Object
- java.lang.Enum<MockReset>
- org.springframework.boot.test.mock.mockito.MockReset
- All Implemented Interfaces:
Serializable,Comparable<MockReset>
public enum MockReset extends Enum<MockReset>
Reset strategy used on a mock bean. Usually applied to a mock via the@MockBeanannotation but can also be directly applied to any mock in theApplicationContextusing the static methods.- Since:
- 1.4.0
- See Also:
ResetMocksTestExecutionListener
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.mockito.MockSettingsafter()Createsettingsto be used with mocks where reset should occur after each test method runs.static org.mockito.MockSettingsapply(MockReset reset, org.mockito.MockSettings settings)ApplyMockResetto existingsettings.static org.mockito.MockSettingsbefore()Createsettingsto be used with mocks where reset should occur before each test method runs.static MockResetvalueOf(String name)Returns the enum constant of this type with the specified name.static MockReset[]values()Returns an array containing the constants of this enum type, in the order they are declared.static org.mockito.MockSettingswithSettings(MockReset reset)Createsettingsto be used with mocks where a specific reset should occur.
Method Detail
values
public static MockReset[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MockReset c : MockReset.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static MockReset valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
before
public static org.mockito.MockSettings before()
Createsettingsto be used with mocks where reset should occur before each test method runs.- Returns:
- mock settings
after
public static org.mockito.MockSettings after()
Createsettingsto be used with mocks where reset should occur after each test method runs.- Returns:
- mock settings
withSettings
public static org.mockito.MockSettings withSettings(MockReset reset)
Createsettingsto be used with mocks where a specific reset should occur.- Parameters:
reset- the reset type- Returns:
- mock settings