@Test
public void testGetMany() throws Exception {

  // First off issue a request with no retries. At this point, the requests for keys "b" and
  // "h" will error out.
  TerrapinResponse response = terrapinClient.getManyNoRetries(FILE_SET, (Set) ImmutableSet.of(
      ByteBuffer.wrap("a".getBytes()),
      ByteBuffer.wrap("b".getBytes()),
      ByteBuffer.wrap("c".getBytes()),
      ByteBuffer.wrap("d".getBytes()),
      ByteBuffer.wrap("h".getBytes()),
      ByteBuffer.wrap("i".getBytes()))).get();
  Map<ByteBuffer, TerrapinSingleResponse> responseMap = response.getResponseMap();
  assertEquals(5, responseMap.size());
  checkValue("a", "value_a", responseMap);
  checkValue("c", "value_c", responseMap);
  checkValue("d", "value_d", responseMap);
  checkError("b", TerrapinGetErrorCode.READ_ERROR, responseMap);
  checkError("h", TerrapinGetErrorCode.OTHER, responseMap);
  // First off issue a request with no retries. At this point, the requests for keys "b" and
  // "h" will error out.
  response = terrapinClient.getMany(FILE_SET, (Set) ImmutableSet.of(
          ByteBuffer.wrap("a".getBytes()),
          ByteBuffer.wrap("b".getBytes()),
          ByteBuffer.wrap("c".getBytes()),
          ByteBuffer.wrap("d".getBytes()),
          ByteBuffer.wrap("h".getBytes()),
          ByteBuffer.wrap("i".getBytes()))).get();
  responseMap = response.getResponseMap();
  assertEquals(5, responseMap.size());
  checkValue("a", "value_a", responseMap);
  checkValue("c", "value_c", responseMap);
  checkValue("d", "value_d", responseMap);
  // "b" gets retried on host3 and succeeds.
  checkValue("b", "value_b", responseMap);
  // "h" gets retried on host1 but host1 is not serving partition #3 and we get a
  // NOT_SERVING_PARTITION error.
  checkError("h", TerrapinGetErrorCode.NOT_SERVING_PARTITION, responseMap);
}