@Test
  public void testEntriesRecursive() throws CacheException {
    if (!supportsSubregions()) {
      return;
    }
    String name = getUniqueName();
    Region<String, String> region = createRegion(name);

    region.put("A", "a");
    region.put("B", "b");
    region.put("C", "c");
    Region<String, String> sub = region.createSubregion("SUB", region.getAttributes());
    sub.put("D", "d");
    sub.put("E", "e");
    sub.put("F", "f");

    {
      Set entries = region.entrySet(true);
      assertEquals(6, entries.size());


      Set<Object> keys = new HashSet<>(Arrays.asList("A", "B", "C", "D", "E", "F"));
      Iterator iter = entries.iterator();
      for (int i = 0; i < 6; i++) {
        assertTrue("!hasNext, i=" + i, iter.hasNext());
        assertTrue("remove returned false, i=" + i,
            keys.remove(((Region.Entry) iter.next()).getKey()));
      }
      assertFalse(iter.hasNext());
    }

    {
      Set<Region.Entry<?, ?>> entries = region.entrySet(true);
      assertEquals(6, entries.size());


      Set<Object> keys = new HashSet<>(Arrays.asList("A", "B", "C", "D", "E", "F"));
      Iterator<Region.Entry<?, ?>> iter = entries.iterator();
      for (int i = 0; i < 6; i++) {
        assertTrue("!hasNext, i=" + i, iter.hasNext());
        assertTrue("remove returned false, i=" + i,
            keys.remove(iter.next().getKey()));
      }
      assertFalse(iter.hasNext());
    }

    {
      Iterator iter = region.entrySet(true).iterator();
      Region.Entry<String, String> entry = (Region.Entry) iter.next();
      String key = entry.getKey();
      region.destroy(key);
      assertFalse(region.containsKey(key));
      assertTrue(entry.isDestroyed());
    }

  }
Tests the {@link Region#entrySet} method with recursion
geode-dunit/src/main/java/org/apache/geode/cache30/RegionTestCase.java