@Test
  public void testMutations() {
    Class<?> cl;
    long expected;
    long actual;

    cl = TimeRange.class;
    actual = ClassSize.TIMERANGE;
    expected = ClassSize.estimateBase(cl, false);
    if (expected != actual) {
      ClassSize.estimateBase(cl, true);
      assertEquals(expected, actual);
    }

    byte[] row = new byte[] { 0 };
    cl = Put.class;
    actual = Mutation.MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY);
    expected = ClassSize.estimateBase(cl, false);
    // The actual TreeMap is not included in the above calculation
    expected += ClassSize.align(ClassSize.TREEMAP);
    expected += ClassSize.align(ClassSize.INTEGER); // priority
    if (expected != actual) {
      ClassSize.estimateBase(cl, true);
      assertEquals(expected, actual);
    }

    cl = Delete.class;
    actual = Mutation.MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY);
    expected = ClassSize.estimateBase(cl, false);
    // The actual TreeMap is not included in the above calculation
    expected += ClassSize.align(ClassSize.TREEMAP);
    expected += ClassSize.align(ClassSize.INTEGER); // priority
    if (expected != actual) {
      ClassSize.estimateBase(cl, true);
      assertEquals(expected, actual);
    }
  }
Testing the classes that implements HeapSize and are a part of 0.20. Some are not tested here
for example BlockIndex which is tested in TestHFile since it is a non public class
hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java