### Question:
InternalChannelz { @Nullable public InternalInstrumented<ChannelStats> getChannel(long id) { return rootChannels.get(id); } @VisibleForTesting  InternalChannelz(); static InternalChannelz instance(); void addServer(InternalInstrumented<ServerStats> server); void addSubchannel(InternalInstrumented<ChannelStats> subchannel); void addRootChannel(InternalInstrumented<ChannelStats> rootChannel); void addClientSocket(InternalInstrumented<SocketStats> socket); void addListenSocket(InternalInstrumented<SocketStats> socket); void addServerSocket(
      InternalInstrumented<ServerStats> server, InternalInstrumented<SocketStats> socket); void removeServer(InternalInstrumented<ServerStats> server); void removeSubchannel(InternalInstrumented<ChannelStats> subchannel); void removeRootChannel(InternalInstrumented<ChannelStats> channel); void removeClientSocket(InternalInstrumented<SocketStats> socket); void removeListenSocket(InternalInstrumented<SocketStats> socket); void removeServerSocket(
      InternalInstrumented<ServerStats> server, InternalInstrumented<SocketStats> socket); RootChannelList getRootChannels(long fromId, int maxPageSize); @Nullable InternalInstrumented<ChannelStats> getChannel(long id); @Nullable InternalInstrumented<ChannelStats> getSubchannel(long id); ServerList getServers(long fromId, int maxPageSize); @Nullable ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize); @Nullable InternalInstrumented<SocketStats> getSocket(long id); @VisibleForTesting boolean containsServer(InternalLogId serverRef); @VisibleForTesting boolean containsSubchannel(InternalLogId subchannelRef); InternalInstrumented<ChannelStats> getRootChannel(long id); @VisibleForTesting boolean containsClientSocket(InternalLogId transportRef); static long id(InternalWithLogId withLogId);  }### Answer:
@Test public void getChannel() { InternalInstrumented<ChannelStats> root = create(); assertNull(channelz.getChannel(id(root))); channelz.addRootChannel(root); assertSame(root, channelz.getChannel(id(root))); assertNull(channelz.getSubchannel(id(root))); channelz.removeRootChannel(root); assertNull(channelz.getRootChannel(id(root))); }