public void asyncRegisterInterestList(VM vm, final String regionName, final int keySize,
      final int policy, final int start) {
    vm.invokeAsync(new CacheSerializableRunnable("Register InterestList") {
      @Override
      public void run2() throws CacheException {

        // Get Query Service.
        Region region = null;
        try {
          if ("root".equals(regionName)) {
            region = getRootRegion();
          } else {
            region = getRootRegion().getSubregion(regionName);
          }
          region.getAttributesMutator()
              .addCacheListener(new CertifiableTestCacheListener());
        } catch (Exception cqe) {
          AssertionError err = new AssertionError("Failed to get Region.", cqe);
          throw err;
        }
        try {
          switch (policy) {
            case REGEX:
              region.registerInterestRegex(REGULAR_EXPRESSION);
              break;
            case KEYS:
              List list = new ArrayList();
              for (int i = start != 0 ? start : 1; i <= keySize; i++) {
                list.add(KEY + i);
              }
              region.registerInterest(list);
              break;
            default:
              region.registerInterest("ALL_KEYS");
          }
        } catch (Exception ex) {
          AssertionError err = new AssertionError("Failed to Register InterestList", ex);
          throw err;
        }
      }
    });
  }
This test tests the RegionClearedException Path in AbsractRegionMap while doing
initialImagePut() during registerInterest on client.
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java