org.mockito.junit.MockitoJUnit#rule()
instead@Deprecated public class InitMockitoMocks extends org.junit.rules.TestWatcher
Just add this to your test:
@Rule public InitMockitoMocks initMocks = new InitMockitoMocks(this); @Mock private UserService mockUserService; @Mock private JiraAuthenticationContext jiraAuthenticationContext;and all your mocks annotated with @Mock will be automatically initialized. No need for runners, or before/after methods!
Constructor and Description |
---|
InitMockitoMocks(Object test)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finished(org.junit.runner.Description description)
Deprecated.
|
protected void |
starting(org.junit.runner.Description description)
Deprecated.
|
public InitMockitoMocks(Object test)
protected void starting(org.junit.runner.Description description)
starting
in class org.junit.rules.TestWatcher
protected void finished(org.junit.runner.Description description)
finished
in class org.junit.rules.TestWatcher
Copyright © 2002-2019 Atlassian. All Rights Reserved.