@Test
  public void handleGoodCaseTest() throws Exception {
    for (String datanode : TailoredPeersClusterMap.DATANODE_NAMES) {
      RestRequest restRequest = getRestRequest(datanode);
      RestResponseChannel restResponseChannel = new MockRestResponseChannel();
      ReadableStreamChannel channel = sendRequestGetResponse(restRequest, restResponseChannel);
      assertNotNull("There should be a response", channel);
      Assert.assertNotNull("Date has not been set", restResponseChannel.getHeader(RestUtils.Headers.DATE));
      assertEquals("Content-type is not as expected", RestUtils.JSON_CONTENT_TYPE,
          restResponseChannel.getHeader(RestUtils.Headers.CONTENT_TYPE));
      assertEquals("Content-length is not as expected", channel.getSize(),
          Integer.parseInt((String) restResponseChannel.getHeader(RestUtils.Headers.CONTENT_LENGTH)));
      Set<String> expectedPeers = clusterMap.getPeers(datanode);
      Set<String> peersFromResponse = getPeersFromResponse(RestTestUtils.getJsonizedResponseBody(channel));
      assertEquals("Peer list returned does not match expected for " + datanode, expectedPeers, peersFromResponse);
    }
  }
Tests for the good cases where the datanodes are correct. The peers obtained from the response is compared
against the ground truth.
@throws Exception
ambry-frontend/src/test/java/com/github/ambry/frontend/GetPeersHandlerTest.java