@Test
  public void testCompareResultMemoryUsage() {
    List<Cell> cells1 = new ArrayList<>();
    for (long i = 0; i < 100; i++) {
      cells1.add(new KeyValue(row, family, Bytes.toBytes(i), value));
    }

    List<Cell> cells2 = new ArrayList<>();
    for (long i = 0; i < 100; i++) {
      cells2.add(new KeyValue(row, family, Bytes.toBytes(i), Bytes.toBytes(i)));
    }

    Result r1 = Result.create(cells1);
    Result r2 = Result.create(cells2);
    try {
      Result.compareResults(r1, r2);
      fail();
    } catch (Exception x) {
      assertTrue(x.getMessage().startsWith("This result was different:"));
      assertThat(x.getMessage().length(), greaterThan(100));
    }

    try {
      Result.compareResults(r1, r2, false);
      fail();
    } catch (Exception x) {
      assertEquals("This result was different: row=row", x.getMessage());
      assertThat(x.getMessage().length(), lessThan(100));
    }
  }
Verify that Result.compareResults(...) behaves correctly.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResult.java