@Test
  public void testCacheListenerAfterRegionInvalidate() throws CacheException, InterruptedException {

    final String name = getUniqueName();

    TestCacheListener listener = new TestCacheListener() {
      private boolean closed = false;
      private boolean invalidated = false;

      @Override
      public boolean wasInvoked() {
        boolean value = invalidated;
        super.wasInvoked();
        return value;
      }

      @Override
      public void close2() {
        closed = true;
      }

      @Override
      public void afterRegionInvalidate2(RegionEvent event) {
        assertEquals(name, event.getRegion().getName());
        assertFalse(event.getOperation().isExpiration());
        assertFalse(event.isOriginRemote());

        invalidated = true;
      }
    };

    AttributesFactory factory = new AttributesFactory(getRegionAttributes());
    factory.setCacheListener(listener);
    RegionAttributes attrs = factory.create();
    Region region;

    region = createRegion(name, attrs);
    region.invalidateRegion();
    Wait.pause(500);
    assertTrue(listener.wasInvoked());
    assertEquals(0, region.values().size());
  }
Tests that the <code>CacheListener</code> is called after a region is invalidated.

@see CacheListener#afterRegionInvalidate
@see CacheListener#close
geode-core/src/distributedTest/java/org/apache/geode/cache30/CacheListenerTestCase.java