@Test
  public void geodeClassesDoNotUseMembershipInternals() {
    ClassFileImporter classFileImporter = getClassFileImporter();
    // create an ImportOption that only allows org.apache.geode classes and
    // membership classes. Prepackaged ImportOptions always cause a package's
    // subpackages to be walked with walkFileTree so you can't examine a single
    // high-level pachage like org.apache.geode without examining its subpackages.
    classFileImporter = classFileImporter.withImportOption(new ImportOption() {
      final Pattern matcher = Pattern.compile(".*/org/apache/geode/[a-zA-z0-9]+/.*");

      @Override
      public boolean includes(Location location) {
        return location.contains("org/apache/geode/distributed/internal/membership")
            || !location.matches(matcher);
      }
    });
    JavaClasses importedClasses = classFileImporter.importPackages(
        "org.apache.geode",
        "org.apache.geode.distributed.internal.membership..");
    checkMembershipAPIUse(importedClasses);
  }
This test ensures that various geode packages do not access membership internals.
It is broken into multiple tests in order to keep memory use low. Analyzing all
geode classes in a single test requires 1.5g of heap.<br>
This test class can be removed if and when we create an isolated Java module that does
not export internal membership classes.
geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/api/CoreOnlyUsesMembershipAPIArchUnitTest.java