BaseNetConfig implements BlockchainNetConfig { public void add(long startBlockNumber, BlockchainConfig config) { if (count >= blockNumbers.length) throw new RuntimeException(); if (count > 0 && blockNumbers[count] >= startBlockNumber) throw new RuntimeException("Block numbers should increase"); if (count == 0 && startBlockNumber > 0) throw new RuntimeException("First config should start from block 0"); blockNumbers[count] = startBlockNumber; configs[count] = config; count++; }  void add(long startBlockNumber, BlockchainConfig config); @Override BlockchainConfig getConfigForBlock(long blockNumber); @Override Constants getCommonConstants(); @Override String toString();  }
@Test(expected = RuntimeException.class) public void addedBlockShouldHaveIncrementedBlockNumber() throws Exception { BlockchainConfig blockchainConfig = new TestBlockchainConfig(); BaseNetConfig config = new BaseNetConfig(); config.add(0, blockchainConfig); config.add(1, blockchainConfig); config.add(0, blockchainConfig); }