@Override
        public void run() {
          InternalDistributedSystem sys = getSystem();
          DistributionManager dm = sys.getDistributionManager();

          Set allRoles = dm.getAllRoles();
          assertEquals(
              "allRoles is " + allRoles.size() + " but roleCounts should be " + roleCounts.length,
              roleCounts.length, allRoles.size());

          for (final Object allRole : allRoles) {
            // match role with string in roleCounts
            Role role = (Role) allRole;
            for (final Object[] roleCount : roleCounts) {
              if (role.getName().equals(roleCount[0])) {
                // parse count
                int count = (Integer) roleCount[1];
                // assert count
                assertEquals("count for role " + role + " is wrong", count, dm.getRoleCount(role));
                assertEquals("isRolePresent for role " + role + " should be true", true,
                    dm.isRolePresent(role));
              }
            }
          }
        }
Tests usage of Roles in four distributed vms.
geode-core/src/distributedTest/java/org/apache/geode/distributed/RoleDUnitTest.java