当前位置: 首页>>代码示例>>Java>>正文


Java EasyMock.expectLastCall方法代码示例

本文整理汇总了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);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:17,代码来源:QueueExtractorTest.java

示例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);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:17,代码来源:WorkerThreadTest.java

示例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();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:29,代码来源:ServiceTest.java

示例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);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:15,代码来源:HttpRequestHandlerAdapterTest.java

示例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);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:13,代码来源:FeedServerClientTest.java

示例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);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:13,代码来源:TypelessFeedServerClientTest.java


注:本文中的org.easymock.classextension.EasyMock.expectLastCall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。