use of org.jmock.core.Invocation in project intellij-plugins by JetBrains.
the class JabberTransport_ConnectionTest method createJabberUIMock.
private Mock createJabberUIMock() {
Mock mockUI = mock(JabberUI.class);
mockUI.stubs().method("connectAndLogin").will(new ReturnStub(Boolean.TRUE) {
@Override
public Object invoke(Invocation invocation) throws Throwable {
myFacade.connect();
return super.invoke(invocation);
}
});
return mockUI;
}
use of org.jmock.core.Invocation in project intellij-plugins by JetBrains.
the class ClearHistoryCommandTest method testClearHistory.
public void testClearHistory() throws Exception {
myIdeMock.expects(once()).method("askQuestion").with(eq(StringUtil.getMsg("ClearHistoryCommand.title")), eq(StringUtil.getMsg("ClearHistoryCommand.text"))).will(returnValue(true));
myIdeMock.expects(once()).method("runLongProcess").will(new CustomStub("runner") {
@Override
public Object invoke(Invocation invocation) throws Throwable {
((IDEFacade.Process) invocation.parameterValues.get(1)).run(new NullProgressIndicator());
return null;
}
});
myIdeMock.expects(once()).method("runOnPooledThread").will(new CustomStub("foo") {
@Override
public Object invoke(Invocation invocation) throws Throwable {
final FutureTask task = new FutureTask((Runnable) invocation.parameterValues.get(0), null);
task.run();
return task;
}
});
myDispatcherMock.expects(once()).method("clearHistory");
myCommand.execute();
}
Aggregations