@Test
  public void testAttributesMutator() throws CacheException {
    String name = getUniqueName();
    AttributesFactory fac = new AttributesFactory(getRegionAttributes());
    fac.setStatisticsEnabled(true);
    Region region = createRegion(name, fac.create());

    CacheListener listener = new TestCacheListener() {};
    CacheLoader loader = new TestCacheLoader() {
      @Override
      public Object load2(LoaderHelper helper) {
        fail("Why was I invoked?");
        return null;
      }
    };
    CacheWriter writer = new TestCacheWriter() {};
    CustomExpiry customEntryIdle = new TestExpiry();
    CustomExpiry customTtl = new TestExpiry();
    ExpirationAttributes entryIdle = new ExpirationAttributes(5, ExpirationAction.DESTROY);
    ExpirationAttributes entryTTL = new ExpirationAttributes(6, ExpirationAction.INVALIDATE);
    ExpirationAttributes regionIdle = new ExpirationAttributes(7, ExpirationAction.DESTROY);
    ExpirationAttributes regionTTL = new ExpirationAttributes(8, ExpirationAction.INVALIDATE);

    AttributesMutator mutator = region.getAttributesMutator();
    assertEquals(region, mutator.getRegion());
    assertSame(region, mutator);

    mutator.addCacheListener(listener);
    mutator.setCacheLoader(loader);
    mutator.setCacheWriter(writer);
    mutator.setEntryIdleTimeout(entryIdle);
    mutator.setCustomEntryIdleTimeout(customEntryIdle);
    mutator.setEntryTimeToLive(entryTTL);
    mutator.setCustomEntryTimeToLive(customTtl);
    mutator.setRegionIdleTimeout(regionIdle);
    mutator.setRegionTimeToLive(regionTTL);

    RegionAttributes attrs = region.getAttributes();
    assertSame(region, attrs);

    assertEquals(listener, attrs.getCacheListener());
    assertEquals(loader, attrs.getCacheLoader());
    assertEquals(writer, attrs.getCacheWriter());
    assertEquals(entryIdle, attrs.getEntryIdleTimeout());
    assertEquals(entryTTL, attrs.getEntryTimeToLive());
    assertEquals(customEntryIdle, attrs.getCustomEntryIdleTimeout());
    assertEquals(customTtl, attrs.getCustomEntryTimeToLive());

    CacheListener listener2 = new TestCacheListener() {};
    CacheLoader loader2 = new TestCacheLoader() {
      @Override
      public Object load2(LoaderHelper helper) {
        fail("Why was I invoked?");
        return null;
      }
    };
    CacheWriter writer2 = new TestCacheWriter() {};
    CustomExpiry customEntryIdle2 = new TestExpiry();
    CustomExpiry customTtl2 = new TestExpiry();
    ExpirationAttributes entryIdle2 = new ExpirationAttributes(5, ExpirationAction.DESTROY);
    ExpirationAttributes entryTTL2 = new ExpirationAttributes(6, ExpirationAction.INVALIDATE);
    ExpirationAttributes regionIdle2 = new ExpirationAttributes(7, ExpirationAction.DESTROY);
    ExpirationAttributes regionTTL2 = new ExpirationAttributes(8, ExpirationAction.INVALIDATE);

    mutator.initCacheListeners(new CacheListener[] {listener2});
    assertEquals(listener2, attrs.getCacheListener());
    assertEquals(loader, mutator.setCacheLoader(loader2));
    assertEquals(writer, mutator.setCacheWriter(writer2));
    assertEquals(entryIdle, mutator.setEntryIdleTimeout(entryIdle2));
    assertEquals(customEntryIdle, mutator.setCustomEntryIdleTimeout(customEntryIdle2));
    assertEquals(entryTTL, mutator.setEntryTimeToLive(entryTTL2));
    assertEquals(customTtl, mutator.setCustomEntryTimeToLive(customTtl2));
    assertEquals(regionIdle, mutator.setRegionIdleTimeout(regionIdle2));
    assertEquals(regionTTL, mutator.setRegionTimeToLive(regionTTL2));
  }
Tests that an {@link AttributesMutator} actually changes the region's attributes. Also tests
the return values of the mutator methods.
geode-core/src/distributedTest/java/org/apache/geode/cache30/RegionAttributesTestCase.java