### Question:
LoadBalancer { public EquivalentAddressGroup getAddresses() { return null; }  abstract void handleResolvedAddressGroups(
      List<EquivalentAddressGroup> servers,
      @NameResolver.ResolutionResultAttr Attributes attributes); abstract void handleNameResolutionError(Status error); abstract void handleSubchannelState(
      Subchannel subchannel, ConnectivityStateInfo stateInfo); abstract void shutdown(); EquivalentAddressGroup getAddresses(); void setAddress(EquivalentAddressGroup addressGroup); void removeInvalidCacheSubchannels(Set<String> removeHostPorts); EquivalentAddressGroup getAddressGroupByHostAndPort(String hostAndPort);  }### Answer:
@Test public void subchannel_getAddresses_delegates() { class OverrideGetAllAddresses extends EmptySubchannel { boolean ran; @Override public List<EquivalentAddressGroup> getAllAddresses() { ran = true; return Arrays.asList(eag); } } OverrideGetAllAddresses subchannel = new OverrideGetAllAddresses(); assertThat(subchannel.getAddresses()).isEqualTo(eag); assertThat(subchannel.ran).isTrue(); }
@Test(expected = IllegalStateException.class) public void subchannel_getAddresses_throwsOnTwoAddrs() { new EmptySubchannel() { boolean ran; @Override public List<EquivalentAddressGroup> getAllAddresses() { ran = true; return Arrays.asList(eag, eag); } }.getAddresses(); }