com.atlassian.jira.junit.rules
Class InitMockitoMocks
java.lang.Object
org.junit.rules.TestWatcher
com.atlassian.jira.junit.rules.InitMockitoMocks
- All Implemented Interfaces:
- org.junit.rules.TestRule
public class InitMockitoMocks
- extends org.junit.rules.TestWatcher
Initializes Mocktio mocks before the tests.
Just add this to your test:
@Rule 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!
- Since:
- 5.1
Method Summary |
protected void |
finished(org.junit.runner.Description description)
|
protected void |
starting(org.junit.runner.Description description)
|
Methods inherited from class org.junit.rules.TestWatcher |
apply, failed, succeeded |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InitMockitoMocks
public InitMockitoMocks(Object test)
starting
protected void starting(org.junit.runner.Description description)
- Overrides:
starting
in class org.junit.rules.TestWatcher
finished
protected void finished(org.junit.runner.Description description)
- Overrides:
finished
in class org.junit.rules.TestWatcher
Copyright © 2002-2013 Atlassian. All Rights Reserved.