Blockchain implements Serializable, PersistenceUnitContainer { @Override public void stopPersistenceUnit() { logger.traceEntry(); for (PersistenceUnit<?, ?> unit : blockchain.values()) { try { unit.close(); } catch (IOException e) { logger.catching(e); } } logger.traceExit(); } 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 testStopPersistenceUnit() throws IOException { CustomTestBlockchain chain = new CustomTestBlockchain(new BlockchainContext()); chain.stopPersistenceUnit(); for(BlockchainUnitType type : blockchainUnitTypes) { BlockchainPersistenceUnit<?, ?> persistenceUnit = chain.getUnit(type); verify(persistenceUnit, times(1)).close(); } }