@After public final void onTestEnd() throws Throwable { ComponentAccessor.initialiseWorker(null); // so did they come out of the test without replaying or verifying mockController.onTestEnd(); mockController = null; }
/** * A synonym for {@link com.atlassian.jira.mock.controller.MockController#instantiate(Class)} * * @param implementationClass the class under test * @return an instance of the class under test */ protected final <T> T instantiate(Class<T> implementationClass) { return mockController.instantiate(implementationClass); }
/** * A simple wrapper function for mockController.reset() * * @param easyMockedCreatedObjects any EasyMocks created via {@link * org.easymock.EasyMock#createMock(Class)} that you also want to verify */ protected final void reset(Object... easyMockedCreatedObjects) { mockController.reset(easyMockedCreatedObjects); }
/** * A simple wrapper function for mockController.verify() * * @param easyMockedCreatedObjects any EasyMocks created via {@link * org.easymock.EasyMock#createMock(Class)} that you also want to verify */ protected final void verify(Object... easyMockedCreatedObjects) { mockController.verify(easyMockedCreatedObjects); }
/** * A synonym for {@link * com.atlassian.jira.mock.controller.MockController#addObjectInstance(Object)} * * @param objectInstance the object instance to add into the mix * @return that same objectInstance */ @SuppressWarnings({"unchecked"}) protected final <T> T addObjectInstance(final T objectInstance) { return mockController.addObjectInstance(objectInstance); }
/** * A synonym for {@link com.atlassian.jira.mock.controller.MockController#getMock(Class)} that * aligns with the name {@link org.easymock.EasyMock#createMock(Class)} * * @param aClassToMock a class to mock out * @return a mock instance of the class */ protected final <T> T createMock(Class<T> aClassToMock) { return mockController.getMock(aClassToMock); }