Blockchain implements Serializable, PersistenceUnitContainer { public void setCurrentBlockIndex(BigInteger currentBlockIndex) { Util.check(currentBlockIndex!=null, "currentBlockIndex!=null"); Util.check(currentBlockIndex.compareTo(BigInteger.ZERO) >= 0, "currentBlockIndex!=null"); this.currentBlockIndex = currentBlockIndex; } 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(expected = IllegalArgumentException.class) public void testSetCurrentBlockIndexWithNullShouldThrowException() throws IOException { blockchain.setCurrentBlockIndex(null); }
@Test(expected = IllegalArgumentException.class) public void testSetCurrentBlockIndexWithNegativeShouldThrowException() throws IOException { blockchain.setCurrentBlockIndex(BigInteger.valueOf(-2)); }
@Test public void testSetCurrentBlockIndex() throws IOException { BigInteger bigInteger = BigInteger.valueOf(5); blockchain.setCurrentBlockIndex(bigInteger); Assert.assertEquals(bigInteger, blockchain.getCurrentBlockIndex()); }