Package io.dropwizard.testing.junit
Class MockitoTestRule
- java.lang.Object
-
- io.dropwizard.testing.junit.MockitoTestRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class MockitoTestRule extends Object implements org.junit.rules.TestRule
A crude hack to allow usingMockitoRulewithRuleChainfor a defined run order. Example:private final MockitoTestRule mockitoRule = new MockitoTestRule(this, MockitoJUnit.rule()); private final ResourceTestRule resourceRule = ResourceTestRule.builder() .addResource(PersonResource::new) .build(); @Rule public final RuleChain ruleChain = RuleChain.outerRule(mockitoRule).around(resourceRule);- See Also:
MockitoRule,RuleChain, #351: missing current instance in TestRule apply(), #997: ClassRule/TestRule version of Mockito's JUnitRule
-
-
Constructor Summary
Constructors Constructor Description MockitoTestRule(Object testInstance, org.mockito.junit.MockitoRule delegate)Create a new adapter for aMockitoRuleinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
-
-
-
Constructor Detail
-
MockitoTestRule
public MockitoTestRule(Object testInstance, org.mockito.junit.MockitoRule delegate)
Create a new adapter for aMockitoRuleinstance.- Parameters:
testInstance- The instance of the test class (which is most likelythis)delegate- The instance ofMockitoRuleto wrap around
-
-