@Test
  public void testKeysIteratorOnLR() throws Exception {
    final String regionName = getUniqueName();
    Region r = getGemfireCache().createRegionFactory(RegionShortcut.REPLICATE).create(regionName);
    r.put("key", "value");
    r.put("key2", "value2");
    r.put("key3", "value3");
    LocalRegion lr = (LocalRegion) r;
    // simulate a removed key
    // region.getRegionMap().getEntry("key")._setValue(Token.REMOVED_PHASE1);
    lr.getRegionMap().getEntry("key").setValue(lr, Token.REMOVED_PHASE1);
    Iterator it = r.keySet().iterator();
    int numKeys = 0;
    while (it.hasNext()) {
      it.next();
      numKeys++;
    }
    assertEquals(2, numKeys);
  }
Test that keys iterator do not returned keys with removed token as its values
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/IteratorDUnitTest.java