@Test
  public void testCacheListenerAfterInvalidateWithForce() throws CacheException {
    AbstractRegionMap.FORCE_INVALIDATE_EVENT = true;
    try {
      String name = getUniqueName();
      final Object key = getUniqueName();
      final Object value = 42;

      TestCacheListener listener = new TestCacheListener() {
        int invalidateCount = 0;

        @Override
        public void afterCreate2(EntryEvent event) {
          // This method will get invoked when the region is populated
        }

        @Override
        public void afterInvalidate2(EntryEvent event) {
          invalidateCount++;
          assertEquals(key, event.getKey());
          if (invalidateCount == 2) {
            assertEquals(value, event.getOldValue());
          } else {
            assertNull(event.getOldValue());
          }
          assertNull(event.getNewValue());
          verifyEventProps(event);
        }
      };

      AttributesFactory factory = new AttributesFactory(getRegionAttributes());
      factory.setCacheListener(listener);
      Region region = createRegion(name, factory.create());

      // Does not exist but should still invoke listener
      try {
        region.invalidate(key);
        fail("expected EntryNotFoundException");
      } catch (EntryNotFoundException ignored) {
      }
      assertTrue(listener.wasInvoked());

      region.create(key, value);
      assertTrue(listener.wasInvoked());
      region.invalidate(key);
      assertTrue(listener.wasInvoked());
      // already invalid but should still invoke listener
      region.invalidate(key);
      assertTrue(listener.wasInvoked());
    } finally {
      AbstractRegionMap.FORCE_INVALIDATE_EVENT = false;
    }
  }
Tests that the <code>CacheListener</code> is called after an entry is
{@linkplain CacheListener#afterInvalidate invalidated}.
geode-core/src/distributedTest/java/org/apache/geode/cache30/CacheListenerTestCase.java