@Test
public void testSubscribeBlock() throws Exception {

  // given
  final BlockTemplate blockTemplate = new BlockTemplate(contextStorage);
  final Requester mockRequester = mock(Requester.class);
  final Subscription<?> expected = mock(Subscription.class);
  when(mockRequester.request(ArgumentMatchers.<Invocation<?>>any())).thenReturn(expected);
  blockTemplate.requester = mockRequester;
  // then
  final StreamObserver<Block> observer = new StreamObserver<Block>() {
    @Override
    public void onNext(Block value) {
    }
    @Override
    public void onError(Throwable t) {
    }
    @Override
    public void onCompleted() {
    }
  };
  assertEquals(expected, blockTemplate.subscribeBlock(observer));
  assertEquals(expected, blockTemplate.subscribeNewBlock(observer));
}