@Test
public void testGetValues() throws Throwable {

  // Set up a null file set to start with.
  hfileReader.setFileSet(null);
  // Test a batch of all even values along with some lookups on non existent keys.
  List<ByteBuffer> keyList = Lists.newArrayListWithCapacity(5000);
  for (int i = 0; i < 10000; i += 2) {
    keyList.add(ByteBuffer.wrap(String.format("%04d", i).getBytes()));
  }
  // Add one not found key.
  keyList.add(ByteBuffer.wrap(String.format("%04d", 15000).getBytes()));
  checkKeyValues(keyList, 5000, 1000, 1);
  assertEquals(5001, Stats.getMetric("lookup-latency-ms").apply().count());
  assertEquals(1000, Stats.getCounter("lookup-errors").apply());
  assertEquals(1, Stats.getCounter("not-found").apply());
  // Test a batch of all odd values along with some lookups on non existent keys.
  // This time, we use "test" as the file set to check if the metrics are recorded
  // correctly.
  hfileReader.setFileSet("test");
  keyList = Lists.newArrayListWithCapacity(5000);
  for (int i = 1; i < 10000; i += 2) {
    keyList.add(ByteBuffer.wrap(String.format("%04d", i).getBytes()));
  }
  // Add one not found key.
  keyList.add(ByteBuffer.wrap(String.format("%04d", 16000).getBytes()));
  checkKeyValues(keyList, 5000, 1000, 1);
  assertEquals(10002, Stats.getMetric("lookup-latency-ms").apply().count());
  assertEquals(5001, Stats.getMetric("test-lookup-latency-ms").apply().count());
  assertEquals(8000, Stats.getMetric("value-size").apply().count());
  assertEquals(4000, Stats.getMetric("test-value-size").apply().count());
  assertEquals(2000, Stats.getCounter("lookup-errors").apply());
  assertEquals(1000, Stats.getCounter("test-lookup-errors").apply());
  assertEquals(2, Stats.getCounter("not-found").apply());
  assertEquals(1, Stats.getCounter("test-not-found").apply());
}