@Test
public void testSubscribeEvent() {

  // given
  final ContractOperation mockOperation = mock(ContractOperation.class);
  when(mockOperation.subscribeEvent(any(EventFilter.class), any(StreamObserver.class)))
      .thenReturn(mock(Subscription.class));
  final AergoClient mockClient = mock(AergoClient.class);
  when(mockClient.getContractOperation()).thenReturn(mockOperation);
  final ClientProvider mockClientProvider = mock(ClientProvider.class);
  when(mockClientProvider.getClient()).thenReturn(mockClient);
  // then
  final QueryApi queryApi = new QueryApiImpl(mockClientProvider);
  final Subscription<Event> subscription = queryApi
      .subscribeEvent(anyEventFilter, new StreamObserver<Event>() {
        @Override
        public void onNext(Event value) {
        }
        @Override
        public void onError(Throwable t) {
        }
        @Override
        public void onCompleted() {
        }
      });
  assertNotNull(subscription);
}