@Override
      public void run2() throws CacheException {
        final Region region = getRootRegion().getSubregion(regions[0]);
        assertNotNull(region);

        // TODO does this WaitCriterion actually help?
        WaitCriterion wc = new WaitCriterion() {
          String excuse;

          @Override
          public boolean done() {
            int sz = region.entrySet().size();
            if (sz == size) {
              return true;
            }
            excuse = "Mismatch, number of keys (" + sz
                + ") in local region is not equal to the interest list size (" + size + ")";
            return false;
          }

          @Override
          public String description() {
            return excuse;
          }
        };
        GeodeAwaitility.await().untilAsserted(wc);

        CertifiableTestCacheListener ctl =
            (CertifiableTestCacheListener) region.getAttributes().getCacheListener();
        for (int i = 1; i <= 10; i++) {
          ctl.waitForCreated(KEY + i);
          assertNotNull(region.getEntry(KEY + i));
        }
      }
Test for InterestList and CQ registered from same clients.
geode-cq/src/distributedTest/java/org/apache/geode/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java