@Test
  public void testCreateSubRegions() throws CacheException {
    if (!supportsSubregions()) {
      return;
    }
    String name = getUniqueName();

    RegionAttributes<Object, Object> attrs = getRegionAttributes();
    RegionFactory<Object, Object> regionFactory = getCache().createRegionFactory(attrs);
    regionFactory.setStatisticsEnabled(true);

    Region<Object, Object> region = createRegion(name, regionFactory);


    attrs = region.getAttributes();

    CacheStatistics stats = region.getStatistics();
    long lastAccessed = stats.getLastAccessedTime();
    long lastModified = stats.getLastModifiedTime();

    try {
      region.createSubregion(name + SEPARATOR + "BAD", attrs);
      fail("Should have thrown an IllegalArgumentException");

    } catch (IllegalArgumentException ex) {
      CacheStatistics stats2 = region.getStatistics();
      assertEquals(lastAccessed, stats2.getLastAccessedTime());
      assertEquals(lastModified, stats2.getLastModifiedTime());
    }

    Region subregion = region.createSubregion(name, attrs);
    assertTrue(attrs != subregion.getAttributes());

    Set subregions = region.subregions(false);
    assertEquals(1, subregions.size());
    assertEquals(subregion, subregions.iterator().next());
  }
Tests creating subregions. Note that this tests accesses the Region's
{@link Region#getStatistics statistics}, so the region must have been created with statistics
enabled.
geode-dunit/src/main/java/org/apache/geode/cache30/RegionTestCase.java