Package org.mockito.junit
Class MockitoJUnit
- java.lang.Object
-
- org.mockito.junit.MockitoJUnit
-
public final class MockitoJUnit extends Object
Mockito supports JUnit via:- JUnit Rules - see
MockitoRule
- JUnit runners - see
MockitoJUnitRunner
- Since:
- 1.10.17
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static VerificationCollector
collector()
Creates a rule instance that can perform lazy verifications.static MockitoRule
rule()
Creates rule instance that initiates @Mocks For more details and examples seeMockitoRule
.static MockitoTestRule
testRule(Object testInstance)
Creates a rule instance that initiates @Mocks and is aTestRule
.
-
-
-
Method Detail
-
rule
public static MockitoRule rule()
Creates rule instance that initiates @Mocks For more details and examples seeMockitoRule
.- Returns:
- the rule instance
- Since:
- 1.10.17
-
testRule
public static MockitoTestRule testRule(Object testInstance)
Creates a rule instance that initiates @Mocks and is aTestRule
. Use this method only when you need to explicitly need aTestRule
, for example if you need to compose multiple rules using aRuleChain
. Otherwise, always preferrule()
SeeMockitoRule
.- Parameters:
testInstance
- The instance to initiate mocks for- Returns:
- the rule instance
- Since:
- 3.3.0
-
collector
public static VerificationCollector collector()
Creates a rule instance that can perform lazy verifications.- Returns:
- the rule instance
- Since:
- 2.1.0
- See Also:
VerificationCollector
-
-