ServiceTest.java 文件源码

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

项目:sstore-soft 作者:
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();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号