本文整理汇总了Java中org.easymock.classextension.EasyMock.expectLastCall方法的典型用法代码示例。如果您正苦于以下问题:Java EasyMock.expectLastCall方法的具体用法?Java EasyMock.expectLastCall怎么用?Java EasyMock.expectLastCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.easymock.classextension.EasyMock
的用法示例。
在下文中一共展示了EasyMock.expectLastCall方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRunCallsQueuedRunnables
import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testRunCallsQueuedRunnables() throws Exception {
RunnableQueue q = EasyMock.createMock(RunnableQueue.class);
Runnable task1 = EasyMock.createMock(Runnable.class);
Runnable task2 = EasyMock.createMock(Runnable.class);
EasyMock.expect(q.remove()).andReturn(task1);
task1.run();
EasyMock.expectLastCall();
EasyMock.expect(q.remove()).andReturn(task2);
task2.run();
EasyMock.expectLastCall();
EasyMock.expect(q.remove()).andThrow(new InterruptedException());
EasyMock.replay(q, task1, task2);
QueueExtractor extractor = new QueueExtractor(q);
extractor.run();
EasyMock.verify(q, task1, task2);
}
示例2: testRun
import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testRun() throws Exception {
RunnableQueue q = EasyMock.createMock(RunnableQueue.class);
Runnable task1 = EasyMock.createMock(Runnable.class);
Runnable task2 = EasyMock.createMock(Runnable.class);
EasyMock.expect(q.remove()).andReturn(task1);
task1.run();
EasyMock.expectLastCall();
EasyMock.expect(q.remove()).andReturn(task2);
task2.run();
EasyMock.expectLastCall();
EasyMock.expect(q.remove()).andThrow(new InterruptedException());
EasyMock.replay(q, task1, task2);
WorkerThread worker = new WorkerThread(q, "test thread");
worker.run();
EasyMock.verify(q, task1, task2);
}
示例3: testNewReflectiveService
import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testNewReflectiveService() {
ServiceWithNoOuter.Interface impl =
control.createMock(ServiceWithNoOuter.Interface.class);
RpcController controller = control.createMock(RpcController.class);
Service service = ServiceWithNoOuter.newReflectiveService(impl);
MethodDescriptor fooMethod =
ServiceWithNoOuter.getDescriptor().findMethodByName("Foo");
MessageWithNoOuter request = MessageWithNoOuter.getDefaultInstance();
RpcCallback<Message> callback = new RpcCallback<Message>() {
public void run(Message parameter) {
// No reason this should be run.
fail();
}
};
RpcCallback<TestAllTypes> specializedCallback =
RpcUtil.specializeCallback(callback);
impl.foo(EasyMock.same(controller), EasyMock.same(request),
EasyMock.same(specializedCallback));
EasyMock.expectLastCall();
control.replay();
service.callMethod(fooMethod, controller, request, callback);
control.verify();
}
示例4: testHandleRequest
import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
@Test
public void testHandleRequest() throws Exception {
FilterChain chain = EasyMock.createMock(FilterChain.class);
HttpRequest request = EasyMock.createMock(HttpRequest.class);
HttpResponse response = EasyMock.createMock(HttpResponse.class);
HttpRequestHandlerAdapter adapter = new HttpRequestHandlerAdapter(chain);
chain.doFilter(EasyMock.isA(HttpServletRequestAdapter.class),
EasyMock.isA(HttpServletResponseAdapter.class));
EasyMock.expectLastCall();
EasyMock.expect(request.getConnectionInformation()).andReturn(null);
EasyMock.replay(chain, request, response);
adapter.handleRequest(request, response);
EasyMock.verify(chain, request, response);
}
示例5: testDeleteEntry
import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testDeleteEntry() throws Exception {
// Setup
mockService.delete(new URL(TEST_FEED_URL));
EasyMock.expectLastCall();
EasyMock.replay(mockService);
// Perform Test
feedServerClient.deleteEntity(new URL(BASE_URL), testUtil.getSampleVehicleBean());
// Verify
EasyMock.verify(mockService);
}
示例6: testDeleteEntry
import org.easymock.classextension.EasyMock; //导入方法依赖的package包/类
public void testDeleteEntry() throws Exception {
// Setup
mockService.delete(new URL(TEST_ENTRY_URL));
EasyMock.expectLastCall();
EasyMock.replay(mockService);
// Perform Test
feedServerClient.deleteEntry(new URL(TEST_ENTRY_URL));
// Verify
EasyMock.verify(mockService);
}