@Test public void testGetBestBlockHeight() { final long expected = 300L; final BlockchainOperation mockOperation = mock(BlockchainOperation.class); when(mockOperation.getBlockchainStatus()) .thenReturn(BlockchainStatus.newBuilder().bestHeight(expected).build()); final AergoClient mockClient = mock(AergoClient.class); when(mockClient.getBlockchainOperation()).thenReturn(mockOperation); final ClientProvider mockClientProvider = mock(ClientProvider.class); when(mockClientProvider.getClient()).thenReturn(mockClient); final QueryApi queryApi = new QueryApiImpl(mockClientProvider); final long actual = queryApi.getBestBlockHeight(); assertEquals(expected, actual); }
@Override public long getBestBlockHeight() { try { return getClient().getBlockchainOperation().getBlockchainStatus().getBestHeight(); } catch (Exception e) { throw converter.convert(e); } }
QueryApiImpl extends AbstractApi implements QueryApi { @Override public long getBestBlockHeight() { try { return getClient().getBlockchainOperation().getBlockchainStatus().getBestHeight(); } catch (Exception e) { throw converter.convert(e); } } }
QueryApiImpl extends AbstractApi implements QueryApi { @Override public long getBestBlockHeight() { try { return getClient().getBlockchainOperation().getBlockchainStatus().getBestHeight(); } catch (Exception e) { throw converter.convert(e); } }  }
QueryApiImpl extends AbstractApi implements QueryApi { @Override public long getBestBlockHeight() { try { return getClient().getBlockchainOperation().getBlockchainStatus().getBestHeight(); } catch (Exception e) { throw converter.convert(e); } }  @Override AccountState getAccountState(final AccountAddress accountAddress); @Override AccountAddress getNameOwner(final String name); @Override AccountAddress getNameOwner(final Name name); @Override AccountAddress getNameOwner(final String name, final long blockNumber); @Override AccountAddress getNameOwner(final Name name, final long blockNumber); @Override StakeInfo getStakingInfo(final AccountAddress accountAddress); @Override StakeInfo getStakeInfo(AccountAddress accountAddress); @Override List<ElectedCandidate> listElectedBps(final int showCount); @Override List<ElectedCandidate> listElected(final String voteId, final int showCount); @Override AccountTotalVote getVotesOf(final AccountAddress accountAddress); @Override BlockHash getBestBlockHash(); @Override long getBestBlockHeight(); @Override ChainIdHash getChainIdHash(); @Override BlockchainStatus getBlockchainStatus(); @Override ChainInfo getChainInfo(); @Override ChainStats getChainStats(); @Override List<Peer> listPeers(); @Override List<Peer> listPeers(final boolean showHidden, final boolean showSelf); @Override List<PeerMetric> listPeerMetrics(); @Override ServerInfo getServerInfo(final List<String> categories); @Override NodeStatus getNodeStatus(); @Override BlockMetadata getBlockMetadata(final BlockHash blockHash); @Override BlockMetadata getBlockMetadata(final long height); @Override List<BlockMetadata> listBlockMetadatas(final BlockHash blockHash, final int size); @Override List<BlockMetadata> listBlockMetadatas(final long height, final int size); @Override Block getBlock(final BlockHash blockHash); @Override Block getBlock(final long height); @Override Subscription<BlockMetadata> subscribeNewBlockMetadata(
      final StreamObserver<BlockMetadata> observer); @Override Subscription<Block> subscribeNewBlock(final StreamObserver<Block> observer); @Override Subscription<BlockMetadata> subscribeBlockMetadata(
      final StreamObserver<BlockMetadata> observer); @Override Subscription<Block> subscribeBlock(final StreamObserver<Block> observer); @Override Transaction getTransaction(final TxHash txHash); @Override TxReceipt getTxReceipt(final TxHash txHash); @Override ContractTxReceipt getContractTxReceipt(final TxHash contractTxHash); @Override ContractInterface getContractInterface(final ContractAddress contractAddress); @Override ContractResult query(final ContractInvocation contractInvocation); @Override ContractResult queryContract(ContractInvocation contractInvocation); @Override List<Event> listEvents(final EventFilter filter); @Override Subscription<Event> subscribeEvent(final EventFilter filter,
      final StreamObserver<Event> observer); }
QueryApiImpl extends AbstractApi implements QueryApi { @Override public long getBestBlockHeight() { try { return getClient().getBlockchainOperation().getBlockchainStatus().getBestHeight(); } catch (Exception e) { throw converter.convert(e); } }  @Override AccountState getAccountState(final AccountAddress accountAddress); @Override AccountAddress getNameOwner(final String name); @Override AccountAddress getNameOwner(final Name name); @Override AccountAddress getNameOwner(final String name, final long blockNumber); @Override AccountAddress getNameOwner(final Name name, final long blockNumber); @Override StakeInfo getStakingInfo(final AccountAddress accountAddress); @Override StakeInfo getStakeInfo(AccountAddress accountAddress); @Override List<ElectedCandidate> listElectedBps(final int showCount); @Override List<ElectedCandidate> listElected(final String voteId, final int showCount); @Override AccountTotalVote getVotesOf(final AccountAddress accountAddress); @Override BlockHash getBestBlockHash(); @Override long getBestBlockHeight(); @Override ChainIdHash getChainIdHash(); @Override BlockchainStatus getBlockchainStatus(); @Override ChainInfo getChainInfo(); @Override ChainStats getChainStats(); @Override List<Peer> listPeers(); @Override List<Peer> listPeers(final boolean showHidden, final boolean showSelf); @Override List<PeerMetric> listPeerMetrics(); @Override ServerInfo getServerInfo(final List<String> categories); @Override NodeStatus getNodeStatus(); @Override BlockMetadata getBlockMetadata(final BlockHash blockHash); @Override BlockMetadata getBlockMetadata(final long height); @Override List<BlockMetadata> listBlockMetadatas(final BlockHash blockHash, final int size); @Override List<BlockMetadata> listBlockMetadatas(final long height, final int size); @Override Block getBlock(final BlockHash blockHash); @Override Block getBlock(final long height); @Override Subscription<BlockMetadata> subscribeNewBlockMetadata(
      final StreamObserver<BlockMetadata> observer); @Override Subscription<Block> subscribeNewBlock(final StreamObserver<Block> observer); @Override Subscription<BlockMetadata> subscribeBlockMetadata(
      final StreamObserver<BlockMetadata> observer); @Override Subscription<Block> subscribeBlock(final StreamObserver<Block> observer); @Override Transaction getTransaction(final TxHash txHash); @Override TxReceipt getTxReceipt(final TxHash txHash); @Override ContractTxReceipt getContractTxReceipt(final TxHash contractTxHash); @Override ContractInterface getContractInterface(final ContractAddress contractAddress); @Override ContractResult query(final ContractInvocation contractInvocation); @Override ContractResult queryContract(ContractInvocation contractInvocation); @Override List<Event> listEvents(final EventFilter filter); @Override Subscription<Event> subscribeEvent(final EventFilter filter,
      final StreamObserver<Event> observer);  }