@Test
  public void testGroups() {
    final LocatorLoadSnapshot sn = new LocatorLoadSnapshot();
    final ServerLocation l1 = new ServerLocation("localhost", 1);
    final ServerLocation l2 = new ServerLocation("localhost", 2);
    final String uniqueId1 = new InternalDistributedMember("localhost", 1).getUniqueId();
    final String uniqueId2 = new InternalDistributedMember("localhost", 2).getUniqueId();
    sn.addServer(l1, uniqueId1, new String[] {"a", "b"}, new ServerLoad(1, 1, 1, 1),
        LOAD_POLL_INTERVAL);
    sn.addServer(l2, uniqueId2, new String[] {"b", "c"}, new ServerLoad(1, 1, 1, 1),
        LOAD_POLL_INTERVAL);
    assertThat(sn.getServerForConnection(null, Collections.emptySet())).isNotNull();
    assertThat(sn.getServerForConnection("a", Collections.emptySet())).isEqualTo(l1);
    assertThat(sn.getServerForConnection("c", Collections.emptySet())).isEqualTo(l2);
    sn.updateLoad(l1, uniqueId1, new ServerLoad(10, 1, 1, 1));
    assertThat(sn.getServerForConnection("b", Collections.emptySet())).isEqualTo(l2);
    sn.updateLoad(l2, uniqueId2, new ServerLoad(100, 1, 1, 1));
    assertThat(sn.getServerForConnection("b", Collections.emptySet())).isEqualTo(l1);
    assertThat(sn.getServersForQueue("a", Collections.emptySet(), -1)).isEqualTo(
        Collections.singletonList(l1));
    assertThat(sn.getServersForQueue("c", Collections.emptySet(), -1)).isEqualTo(
        Collections.singletonList(l2));
    assertThat(sn.getServersForQueue("b", Collections.emptySet(), -1)).isEqualTo(
        Arrays.asList(l1, l2));
    assertThat(sn.getServersForQueue(null, Collections.emptySet(), -1)).isEqualTo(
        Arrays.asList(l1, l2));
    assertThat(sn.getServersForQueue("b", Collections.emptySet(), 5)).isEqualTo(
        Arrays.asList(l1, l2));

    sn.removeServer(l1, uniqueId1);
    assertThat(sn.getServerForConnection("b", Collections.emptySet())).isEqualTo(l2);
    assertThat(sn.getServerForConnection("b", Collections.emptySet())).isEqualTo(l2);
    assertThat(sn.getServerForConnection("a", Collections.emptySet())).isNull();
    assertThat(sn.getServerForConnection("c", Collections.emptySet())).isEqualTo(l2);
    assertThat(sn.getServersForQueue("a", Collections.emptySet(), -1)).isEqualTo(
        Collections.emptyList());
    assertThat(sn.getServersForQueue("b", Collections.emptySet(), 5)).isEqualTo(
        Collections.singletonList(l2));
  }
Test of server groups. Make sure that the snapshot returns only servers from the correct group.
geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotTest.java