private void assertContains(Locations locations, HashSet<String> tservers, Map<Range,ImmutableSet<TabletId>> expected1, Map<TabletId,ImmutableSet<Range>> expected2) { Map<Range,Set<TabletId>> gbr = new HashMap<>(); for (Entry<Range,List<TabletId>> entry : locations.groupByRange().entrySet()) { gbr.put(entry.getKey(), new HashSet<>(entry.getValue())); } Assert.assertEquals(expected1, gbr); Map<TabletId,Set<Range>> gbt = new HashMap<>(); for (Entry<TabletId,List<Range>> entry : locations.groupByTablet().entrySet()) { gbt.put(entry.getKey(), new HashSet<>(entry.getValue())); TabletId tid = entry.getKey(); String location = locations.getTabletLocation(tid); Assert.assertNotNull("Location for " + tid + " was null", location); Assert.assertTrue("Unknown location " + location, tservers.contains(location)); Assert.assertTrue("Expected <host>:<port> " + location, location.split(":").length == 2); } Assert.assertEquals(expected2, gbt); }