Package org.mockito.junit
Class MockitoJUnit
java.lang.Object
org.mockito.junit.MockitoJUnit
Mockito supports JUnit via:
- JUnit Rules - see
MockitoRule
- JUnit runners - see
MockitoJUnitRunner
- Since:
- 1.10.17
-
Method Summary
Modifier and TypeMethodDescriptionstatic VerificationCollector
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
Creates a rule instance that initiates @Mocks and is aTestRule
.
-
Method Details
-
rule
Creates rule instance that initiates @Mocks For more details and examples seeMockitoRule
.- Returns:
- the rule instance
- Since:
- 1.10.17
-
testRule
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
Creates a rule instance that can perform lazy verifications.- Returns:
- the rule instance
- Since:
- 2.1.0
- See Also:
-