AppState implements Serializable { public P2PRequestChannel getChannel(P2PRequestChannelName channelName) { logger.traceEntry("params: {}", channelName); Util.check(channelName != null, "channelName!=null"); return logger.traceExit(requestChannels.get(channelName)); }  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 testGetChannelWithNullChannelNameShouldThrowException(){ appState.getChannel((P2PBroadcastChannelName) null); }
@Test public void testGetChannelWithUnknownChannel(){ P2PBroadcastChannel channel = appState.getChannel(P2PBroadcastChannelName.BLOCK); Assert.assertNull(channel); }