@Test
  public void testSubRegionsRecursive() throws CacheException {
    if (!supportsSubregions()) {
      return;
    }

    String name = getUniqueName();
    Region<Object, Object> region = createRegion(name);
    RegionFactory<Object, Object> regionFactory =
        getCache().createRegionFactory(region.getAttributes());
    Region A = regionFactory.createSubregion(region, "A");
    Region B = regionFactory.createSubregion(region, "B");
    Region C = regionFactory.createSubregion(region, "C");

    regionFactory.createSubregion(A, "D");
    regionFactory.createSubregion(B, "E");
    regionFactory.createSubregion(C, "F");


    {
      Set subRegions = region.subregions(true);
      assertEquals(6, subRegions.size());

      Set<Object> names = new HashSet<>(Arrays.asList("A", "B", "C", "D", "E", "F"));
      Iterator iter = subRegions.iterator();
      for (int i = 0; i < 6; i++) {
        assertTrue(iter.hasNext());
        assertTrue(names.remove(((Region) iter.next()).getName()));
      }
      assertFalse(iter.hasNext());
    }
  }
Tests the {@link Region#subregions} method with recursion
geode-dunit/src/main/java/org/apache/geode/cache30/RegionTestCase.java