@Test
  public void testAddGroupsWithServerLocation() {
    final LocatorLoadSnapshot loadSnapshot = new LocatorLoadSnapshot();

    final ServerLocation sl1 = new ServerLocation("localhost", 1);
    final ServerLocation sl2 = new ServerLocation("localhost", 2);
    final ServerLocation sl3 = new ServerLocation("localhost", 3);

    LocatorLoadSnapshot.LoadHolder loadHolder1 =
        new LocatorLoadSnapshot.LoadHolder(sl1, 50, 1, LOAD_POLL_INTERVAL);
    LocatorLoadSnapshot.LoadHolder loadHolder2 =
        new LocatorLoadSnapshot.LoadHolder(sl2, 50, 1, LOAD_POLL_INTERVAL);
    LocatorLoadSnapshot.LoadHolder loadHolder3 =
        new LocatorLoadSnapshot.LoadHolder(sl3, 50, 1, LOAD_POLL_INTERVAL);

    Map<String, Map<ServerLocation, LocatorLoadSnapshot.LoadHolder>> map =
        new HashMap<>();

    loadSnapshot.addGroups(map, new String[] {"a"}, loadHolder1);
    loadSnapshot.addGroups(map, new String[] {"a", "b"}, loadHolder2);
    loadSnapshot.addGroups(map, new String[] {}, loadHolder3);

    assertThat(map.get(null)).containsOnly(entry(sl1, loadHolder1), entry(sl2, loadHolder2),
        entry(sl3, loadHolder3));
    assertThat(map.get("a")).containsOnly(entry(sl1, loadHolder1), entry(sl2, loadHolder2));
    assertThat(map.get("b")).containsOnly(entry(sl2, loadHolder2));
  }
Test that we can specify a list of servers to exclude and the snapshot honors the request when
picking the best server.
geode-core/src/test/java/org/apache/geode/distributed/internal/LocatorLoadSnapshotTest.java