GtidSet { @Override public String toString() { List<String> gtids = new ArrayList<String>(); for (UUIDSet uuidSet : uuidSetsByServerId.values()) { gtids.add(uuidSet.toString()); } return String.join(",", gtids); } protected  GtidSet(Map<String, UUIDSet> uuidSetsByServerId);  GtidSet(String gtids); GtidSet retainAll(Predicate<String> sourceFilter); Collection<UUIDSet> getUUIDSets(); UUIDSet forServerWithId(String uuid); boolean isContainedWithin(GtidSet other); GtidSet with(GtidSet other); GtidSet getGtidSetBeginning(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void shouldCollapseAdjacentIntervals() { gtids = new GtidSet(UUID1 + ":1-191:192-199"); asertIntervalCount(UUID1, 1); asertIntervalExists(UUID1, 1, 199); asertFirstInterval(UUID1, 1, 199); asertLastInterval(UUID1, 1, 199); assertThat(gtids.toString()).isEqualTo(UUID1 + ":1-199"); }
@Test public void shouldNotCollapseNonAdjacentIntervals() { gtids = new GtidSet(UUID1 + ":1-191:193-199"); asertIntervalCount(UUID1, 2); asertFirstInterval(UUID1, 1, 191); asertLastInterval(UUID1, 193, 199); assertThat(gtids.toString()).isEqualTo(UUID1 + ":1-191:193-199"); }
@Test public void shouldCreateWithMultipleIntervals() { gtids = new GtidSet(UUID1 + ":1-191:193-199:1000-1033"); asertIntervalCount(UUID1, 3); asertFirstInterval(UUID1, 1, 191); asertIntervalExists(UUID1, 193, 199); asertLastInterval(UUID1, 1000, 1033); assertThat(gtids.toString()).isEqualTo(UUID1 + ":1-191:193-199:1000-1033"); }
@Test public void shouldCreateWithMultipleIntervalsThatMayBeAdjacent() { gtids = new GtidSet(UUID1 + ":1-191:192-199:1000-1033:1035-1036:1038-1039"); asertIntervalCount(UUID1, 4); asertFirstInterval(UUID1, 1, 199); asertIntervalExists(UUID1, 1000, 1033); asertIntervalExists(UUID1, 1035, 1036); asertLastInterval(UUID1, 1038, 1039); assertThat(gtids.toString()).isEqualTo(UUID1 + ":1-199:1000-1033:1035-1036:1038-1039"); }
@Test public void shouldCreateSetWithSingleInterval() { gtids = new GtidSet(UUID1 + ":1-191"); asertIntervalCount(UUID1, 1); asertIntervalExists(UUID1, 1, 191); asertFirstInterval(UUID1, 1, 191); asertLastInterval(UUID1, 1, 191); assertThat(gtids.toString()).isEqualTo(UUID1 + ":1-191"); }