Blockchain implements Serializable, PersistenceUnitContainer { public P2PConnection getConnection() { return context.getConnection(); } Blockchain(BlockchainContext context); void generatePersistenceUnitMap(BlockchainContext context); @SuppressWarnings("unchecked") BlockchainPersistenceUnit<H, B> getUnit(BlockchainUnitType type); Class<B> getClazz(BlockchainUnitType type); BlockchainContext getContext(); P2PConnection getConnection(); Block getCurrentBlock(); void setCurrentBlock(Block currentBlock); Block getGenesisBlock(); void setGenesisBlock(Block genesisBlock); BigInteger getCurrentBlockIndex(); void setCurrentBlockIndex(BigInteger currentBlockIndex); Shard getShard(); void flush(); @Override void stopPersistenceUnit(); TransactionsPool getPool(); BigInteger getNetworkHeight(); synchronized void setNetworkHeight(BigInteger networkBlockHeight); @Override String toString();  }
@Test public void testGetConnection() throws IOException { BlockchainContext context = mock(BlockchainContext.class); P2PConnection p2PConnection = mock(P2PConnection.class); when(context.getConnection()).thenReturn(p2PConnection); Blockchain blockchain = new Blockchain(context); Assert.assertEquals(p2PConnection, blockchain.getConnection()); }