@Test
  public void closeCacheShouldStopLocalManager() {
    managementTestRule.createMember(memberVMs[0]);
    managementTestRule.createMember(memberVMs[1]);

    managementTestRule.createManager(memberVMs[2], false);

    // Only creates a cache in Managing Node
    // Does not start the managerVM
    managementTestRule.createManager(managerVM, false);

    memberVMs[2].invoke(this::startManager);

    memberVMs[2].invoke(() -> {
      SystemManagementService service = managementTestRule.getSystemManagementService();
      LocalManager localManager = service.getLocalManager();
      managementTestRule.getCache().close();
      assertThat(localManager.isRunning()).isFalse();
      assertThat(service.isManager()).isFalse();
      assertThat(service.getLocalManager()).isNull();
    });
  }
Creates and starts a managerVM. Multiple Managers
geode-core/src/distributedTest/java/org/apache/geode/management/CacheManagementDUnitTest.java