ServiceTest.java 文件源码

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

项目:s-store 作者:
/** Tests generated stubs. */
public void testStub() throws Exception {
  FooRequest fooRequest = FooRequest.newBuilder().build();
  BarRequest barRequest = BarRequest.newBuilder().build();
  MockCallback<FooResponse> fooCallback = new MockCallback<FooResponse>();
  MockCallback<BarResponse> barCallback = new MockCallback<BarResponse>();
  RpcChannel mockChannel = control.createMock(RpcChannel.class);
  TestService stub = TestService.newStub(mockChannel);

  mockChannel.callMethod(
    EasyMock.same(fooDescriptor),
    EasyMock.same(mockController),
    EasyMock.same(fooRequest),
    EasyMock.same(FooResponse.getDefaultInstance()),
    this.<Message>wrapsCallback(fooCallback));
  mockChannel.callMethod(
    EasyMock.same(barDescriptor),
    EasyMock.same(mockController),
    EasyMock.same(barRequest),
    EasyMock.same(BarResponse.getDefaultInstance()),
    this.<Message>wrapsCallback(barCallback));
  control.replay();

  stub.foo(mockController, fooRequest, fooCallback);
  stub.bar(mockController, barRequest, barCallback);
  control.verify();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号