AppState implements Serializable { public void setBlockchain(Blockchain blockchain) { logger.traceEntry("params: {}", blockchain); Util.check(blockchain != null, "blockchain!=null"); this.blockchain = blockchain; logger.traceExit(); }  P2PRequestChannel getChannel(P2PRequestChannelName channelName); void addChannel(P2PRequestChannel requestChanel); P2PBroadcastChannel getChannel(P2PBroadcastChannelName channelName); void addChannel(P2PBroadcastChannel broadcastChannel); P2PConnection getConnection(); void setConnection(P2PConnection connection); boolean isStillRunning(); void setStillRunning(boolean stillRunning); void setBlockchain(Blockchain blockchain); Blockchain getBlockchain(); Accounts getAccounts(); void setAccounts(Accounts accounts); void shutdown(); void setPrivateKey(PrivateKey privateKey); PrivateKey getPrivateKey(); PublicKey getPublicKey(); NTPClient getNtpClient(); void setNtpClient(NTPClient ntpClient); ConsensusData getConsensusData(); Shard getShard(); void setShard(Shard shard); StatisticsManager getStatisticsManager(); TransactionsPool getPool(); public Object lockerSyncPropose; }
@Test(expected = IllegalArgumentException.class) public void testSetBlockchainWithNullBlockchainShouldThrowException(){ appState.setBlockchain(null); }
@Test public void testSetBlockchain(){ Blockchain blockchain = mock(Blockchain.class); appState.setBlockchain(blockchain); Assert.assertEquals(blockchain, appState.getBlockchain()); }