public class MockitoJUnitRunner
extends org.junit.runner.Runner
implements org.junit.runner.manipulation.Filterable
Mock
,
so that explicit usage of MockitoAnnotations.initMocks(Object)
is not necessary.
Mocks are initialized before each test method.
Mockito.validateMockitoUsage()
.
Mockito.validateMockitoUsage()
.
Read more about @Mock annotation in javadoc for MockitoAnnotations
@RunWith(MockitoJUnit44Runner.class) public class ExampleTest { @Mock private List list; @Test public void shouldDoSomething() { list.add(100); } }
Constructor and Description |
---|
MockitoJUnitRunner(Class<?> klass) |
Modifier and Type | Method and Description |
---|---|
void |
filter(org.junit.runner.manipulation.Filter filter) |
org.junit.runner.Description |
getDescription() |
void |
run(org.junit.runner.notification.RunNotifier notifier) |
public MockitoJUnitRunner(Class<?> klass) throws InvocationTargetException
InvocationTargetException
public void run(org.junit.runner.notification.RunNotifier notifier)
run
in class org.junit.runner.Runner
public org.junit.runner.Description getDescription()
getDescription
in interface org.junit.runner.Describable
getDescription
in class org.junit.runner.Runner
public void filter(org.junit.runner.manipulation.Filter filter) throws org.junit.runner.manipulation.NoTestsRemainException
filter
in interface org.junit.runner.manipulation.Filterable
org.junit.runner.manipulation.NoTestsRemainException
Copyright © 2018. All rights reserved.