private void testDominates(boolean useTreeSets) {
    try {
      RVVException.UseTreeSetsForTesting = useTreeSets;

      // Simple case, - vh2 has a greater version than vh1
      {
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        RegionVersionHolder vh2 = new RegionVersionHolder(member);

        vh1.recordVersion(100);
        BitSet bs1 = new BitSet();
        bs1.set(1, 100);
        recordVersions(vh1, bs1);

        BitSet bs2 = new BitSet();
        bs2.set(1, 105);
        recordVersions(vh2, bs2);
        assertFalse(vh1.dominates(vh2));
        assertTrue(vh2.dominates(vh1));
      }

      // test with a gap between the bitsetVersion and the version
      {
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        RegionVersionHolder vh2 = new RegionVersionHolder(member);

        BitSet bs1 = new BitSet();
        bs1.set(1, 101);
        recordVersions(vh1, bs1);
        // this test assumes that the width is much greater than 100, so use the
        // original RegionVersionHolder.BIT_SET_WIDTH in order for the assertions to be correct
        vh1.recordVersion(2 * originalBitSetWidth);

        BitSet bs2 = new BitSet();
        bs2.set(1, 2 * originalBitSetWidth + 1);
        recordVersions(vh2, bs2);

        // vh1={rv2048 bsv100 bs={0, 1948}} or {rv2048 bsv2048 bs={0}; [e(n=2048 p=100)]} after
        // merging
        // vh2={rv2048 bsv2047 bs={0, 1}} or {rv2048 bsv2048 bs={0}} after merging

        assertFalse(vh1.dominates(vh2));
        assertTrue(vh2.dominates(vh1));
      }

      // More complicated. vh2 has a higher version, but has
      // some exceptions that vh1 does not have.
      {
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        RegionVersionHolder vh2 = new RegionVersionHolder(member);
        BitSet bs1 = new BitSet();
        bs1.set(1, 21);
        bs1.set(30, 101);
        recordVersions(vh1, bs1);

        BitSet bs2 = new BitSet();
        bs2.set(1, 50);
        bs2.set(60, 105);
        recordVersions(vh2, bs2);

        // double check that we didn't screw up the bit sets
        assertFalse(dominates(bs2, bs1));
        assertFalse(dominates(bs1, bs2));

        assertFalse(vh1.dominates(vh2));
        assertFalse(vh2.dominates(vh1));
      }

      // Same version, but both have some exceptions the other doesn't
      {
        // VH2 will have exceptions for 20-25, 26-30, 41-43
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        BitSet bs1 = new BitSet();

        // record some versions to generate two exceptions
        bs1.set(1, 21);
        bs1.set(30, 41);
        bs1.set(43, 101);
        recordVersions(vh1, bs1);

        // now populate some older versions.
        bs1.set(25);
        bs1.set(26);
        recordVersions(vh1, bs1);

        // VH2 will have exceptions for 20-25, 26-30, 42-45
        RegionVersionHolder vh2 = new RegionVersionHolder(member);
        BitSet bs2 = new BitSet();
        bs2.set(1, 21);
        bs2.set(25, 27);
        bs2.set(30, 43);
        bs2.set(45, 101);
        recordVersions(vh2, bs2);
        assertFalse(vh1.dominates(vh2));
        assertFalse(vh2.dominates(vh1));
      }

      // Same version, but vh2 has an exception that vh1 doesn't
      {
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        BitSet bs1 = new BitSet();
        bs1.set(1, 101);
        recordVersions(vh1, bs1);

        RegionVersionHolder vh2 = new RegionVersionHolder(member);
        BitSet bs2 = new BitSet();
        bs2.set(1, 43);
        bs2.set(45, 101);
        recordVersions(vh2, bs2);

        assertTrue(vh1.dominates(vh2));
        assertFalse(vh2.dominates(vh1));
      }

      // Same version, but vh2 has an exception that vh1 doesn't
      // With overlapping exception
      {
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        BitSet bs1 = new BitSet();
        bs1.set(1, 44);
        bs1.set(45, 101);
        recordVersions(vh1, bs1);

        RegionVersionHolder vh2 = new RegionVersionHolder(member);
        BitSet bs2 = new BitSet();
        bs2.set(1, 40);
        bs2.set(45, 101);
        recordVersions(vh1, bs1);
        assertTrue(vh1.dominates(vh2));
        assertFalse(vh2.dominates(vh1));
      }

      // Same version, but vh2 has an exception that vh1 doesn't
      // With some differently expressed
      // but equivalent exceptions.
      {
        RegionVersionHolder vh1 = new RegionVersionHolder(member);
        BitSet bs1 = new BitSet();
        bs1.set(1, 20);
        bs1.set(30, 101);
        recordVersions(vh1, bs1);

        bs1.set(25);
        bs1.set(26);
        recordVersions(vh1, bs1);

        RegionVersionHolder vh2 = new RegionVersionHolder(member);
        BitSet bs2 = new BitSet();
        bs2.set(1, 20);
        bs2.set(30, 101);
        bs2.set(25);
        bs2.set(26);
        recordVersions(vh2, bs2);
        // vh1.sameAs(vh2); vh2.sameAs(vh1); //force bitsets to be merged
        System.out.println("vh1=" + vh1);
        System.out.println("vh2=" + vh2);
        assertTrue(vh1.dominates(vh2));
        assertTrue(vh2.dominates(vh1));
      }
    } finally {
      RVVException.UseTreeSetsForTesting = false;
    }

  }
Test the dominates relation between RegionVersionHolders.

This test currently fails in the last case with two different holders with the same exception
list expressed differently. Hence it is disabled.

See bug 47106
geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionHolderJUnitTest.java