@Test
  public void testCompareResultsWithTags() throws Exception {
    Tag t1 = new ArrayBackedTag((byte) 1, Bytes.toBytes("TAG1"));
    Tag t2 = new ArrayBackedTag((byte) 2, Bytes.toBytes("TAG2"));
    // Both BB backed tags KV are null
    Result result1 = getByteBufferBackedTagResult(null);
    Result result2 = getByteBufferBackedTagResult(null);
    Result.compareResults(result1, result2);

    // Test both byte buffer backed tags KeyValue
    result1 = getByteBufferBackedTagResult(t1);
    result2 = getByteBufferBackedTagResult(t1);
    Result.compareResults(result1, result2);

    // Both array backed tags KV are null
    result1 = getArrayBackedTagResult(null);
    result2 = getArrayBackedTagResult(null);
    Result.compareResults(result1, result2);

    // Test both array backed tags KeyValue
    result1 = getArrayBackedTagResult(t1);
    result2 = getArrayBackedTagResult(t1);
    Result.compareResults(result1, result2);

    // left instance of byte buffer and right instance of array backed
    result1 = getByteBufferBackedTagResult(t1);
    result2 = getArrayBackedTagResult(t1);
    Result.compareResults(result1, result2);

    // left instance of array backed and right instance of byte buffer backed.
    result1 = getArrayBackedTagResult(t1);
    result2 = getByteBufferBackedTagResult(t1);
    Result.compareResults(result1, result2);

    // Left BB backed null tag and right BB backed non null tag
    result1 = getByteBufferBackedTagResult(null);
    result2 = getByteBufferBackedTagResult(t2);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // Left BB backed non null tag and right BB backed null tag
    result1 = getByteBufferBackedTagResult(t1);
    result2 = getByteBufferBackedTagResult(null);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // Both byte buffer backed tags KV are different
    result1 = getByteBufferBackedTagResult(t1);
    result2 = getByteBufferBackedTagResult(t2);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // Left array backed non null tag and right array backed null tag
    result1 = getArrayBackedTagResult(t1);
    result2 = getArrayBackedTagResult(null);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // Left array backed null tag and right array backed non null tag
    result1 = getByteBufferBackedTagResult(null);
    result2 = getByteBufferBackedTagResult(t2);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // Both array backed tags KV are different
    result1 = getArrayBackedTagResult(t1);
    result2 = getArrayBackedTagResult(t2);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // left instance of byte buffer and right instance of array backed are different
    result1 = getByteBufferBackedTagResult(t1);
    result2 = getArrayBackedTagResult(t2);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }

    // left instance of array backed and right instance of byte buffer backed are different
    result1 = getArrayBackedTagResult(t1);
    result2 = getByteBufferBackedTagResult(t2);
    try {
      Result.compareResults(result1, result2);
      fail();
    } catch (Exception e) {
      // Expected
    }
  }
Verify that Result.compareResults(...) behaves correctly.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java