BlockchainTemplate extends AbstractTemplate implements BlockchainOperation { @Override public ChainStats getChainStats() { return request(blockchainMethods.getChainStats()); } BlockchainTemplate(final ContextStorage<Context> contextStorage); @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();  }
@Test public void testGetChainStats() throws Exception { final BlockchainTemplate blockchainTemplate = new BlockchainTemplate(contextStorage); final Requester mockRequester = mock(Requester.class); final ChainStats expected = ChainStats.newBuilder().build(); when(mockRequester.request(ArgumentMatchers.<Invocation<?>>any())) .thenReturn(expected); blockchainTemplate.requester = mockRequester; final ChainStats actual = blockchainTemplate.getChainStats(); assertEquals(expected, actual); }