@Test
  public void testAddListeners() {
    final InternalResourceManager internalManager = cache.getInternalResourceManager();
    ResourceListener<MemoryEvent> memoryListener =
        event -> cache.getLogger().info("Received MemoryEvent");
    internalManager.addResourceListener(ResourceType.HEAP_MEMORY, memoryListener);

    assertEquals(1 + SYSTEM_LISTENERS,
        internalManager.getResourceListeners(ResourceType.HEAP_MEMORY).size());
  }
creates a distributed region and invokes criticalThresholdReached then does a put to verify
that the put is rejected
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/control/MemoryMonitorJUnitTest.java