@VisibleForTesting
  void handleResponse(DiscoveryResponseData response)
  {
    ResourceType resourceType = response.getResourceType();
    switch (resourceType)
    {
      case NODE:
        handleD2NodeResponse(response);
        break;
      case D2_URI_MAP:
        handleD2URIMapResponse(response);
        break;
      case D2_URI:
        handleD2URICollectionResponse(response);
        break;
      default:
        throw new AssertionError("Missing case in enum switch: " + resourceType);
    }
  }
@Test
  public void testHandleD2URICollectionResponseWithRemoval()
  {
    DiscoveryResponseData removeClusterResponse =
        new DiscoveryResponseData(D2_URI, null, Collections.singletonList(CLUSTER_GLOB_COLLECTION), NONCE, null);

    XdsClientImplFixture fixture = new XdsClientImplFixture();
    fixture._clusterSubscriber.setData(D2_URI_MAP_UPDATE_WITH_DATA1);
    fixture._xdsClientImpl.handleResponse(removeClusterResponse);
    fixture.verifyAckSent(1);
    verify(fixture._resourceWatcher).onChanged(eq(D2_URI_MAP_UPDATE_WITH_DATA1));
    verify(fixture._clusterSubscriber).onRemoval();
    verifyZeroInteractions(fixture._serverMetricsProvider);
    D2URIMapUpdate actualData = (D2URIMapUpdate) fixture._clusterSubscriber.getData();
    // removed resource will not overwrite the original valid data
    Assert.assertEquals(actualData.getURIMap(), D2_URI_MAP_UPDATE_WITH_DATA1.getURIMap());
  }