ServiceTest.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:s-store 作者:
public void testNewReflectiveBlockingService() throws ServiceException {
  ServiceWithNoOuter.BlockingInterface impl =
      control.createMock(ServiceWithNoOuter.BlockingInterface.class);
  RpcController controller = control.createMock(RpcController.class);
  BlockingService service =
      ServiceWithNoOuter.newReflectiveBlockingService(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();
    }
  };

  TestAllTypes expectedResponse = TestAllTypes.getDefaultInstance();
  EasyMock.expect(impl.foo(EasyMock.same(controller), EasyMock.same(request)))
      .andReturn(expectedResponse);

  control.replay();

  Message response =
      service.callBlockingMethod(fooMethod, controller, request);
  assertEquals(expectedResponse, response);

  control.verify();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号