AppState implements Serializable { public void setAccounts(Accounts accounts) { logger.traceEntry("params: {}", accounts); Util.check(accounts != null, "accounts!=null"); this.accounts = accounts; 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 testSetAccountsWithNullAccountsShouldThrowException(){ appState.setAccounts(null); }
@Test public void testSetAccounts(){ Accounts accounts = mock(Accounts.class); appState.setAccounts(accounts); Assert.assertEquals(accounts, appState.getAccounts()); }