### Question:
InternalSubchannel implements InternalInstrumented<ChannelStats> { public void updateAddresses(List<EquivalentAddressGroup> newAddressGroups) { Preconditions.checkNotNull(newAddressGroups, "newAddressGroups"); checkListHasNoNulls(newAddressGroups, "newAddressGroups contains null entry"); Preconditions.checkArgument(!newAddressGroups.isEmpty(), "newAddressGroups is empty"); newAddressGroups = Collections.unmodifiableList(new ArrayList<>(newAddressGroups)); ManagedClientTransport savedTransport = null; try { synchronized (lock) { SocketAddress previousAddress = addressIndex.getCurrentAddress(); addressIndex.updateGroups(newAddressGroups); if (state.getState() == READY || state.getState() == CONNECTING) { if (!addressIndex.seekTo(previousAddress)) { if (state.getState() == READY) { savedTransport = activeTransport; activeTransport = null; addressIndex.reset(); gotoNonErrorState(IDLE); } else { savedTransport = pendingTransport; pendingTransport = null; addressIndex.reset(); startNewTransport(); } } } } } finally { syncContext.drain(); } if (savedTransport != null) { savedTransport.shutdown( Status.UNAVAILABLE.withDescription( "InternalSubchannel closed transport due to address change")); } } InternalSubchannel(List<EquivalentAddressGroup> addressGroups, String authority, String userAgent,
      BackoffPolicy.Provider backoffPolicyProvider,
      ClientTransportFactory transportFactory, ScheduledExecutorService scheduledExecutor,
      Supplier<Stopwatch> stopwatchSupplier, SynchronizationContext syncContext, Callback callback,
      InternalChannelz channelz, CallTracer callsTracer, ChannelTracer channelTracer,
      InternalLogId logId, TimeProvider timeProvider); void updateAddresses(List<EquivalentAddressGroup> newAddressGroups); void shutdown(Status reason); @Override String toString(); @Override InternalLogId getLogId(); @Override ListenableFuture<ChannelStats> getStats();  }### Answer:
@Test public void updateAddresses_emptyEagList_throws() { SocketAddress addr = new FakeSocketAddress(); createInternalSubchannel(addr); thrown.expect(IllegalArgumentException.class); internalSubchannel.updateAddresses(Arrays.<EquivalentAddressGroup>asList()); }
@Test public void updateAddresses_eagListWithNull_throws() { SocketAddress addr = new FakeSocketAddress(); createInternalSubchannel(addr); List<EquivalentAddressGroup> eags = Arrays.asList((EquivalentAddressGroup) null); thrown.expect(NullPointerException.class); internalSubchannel.updateAddresses(eags); }