@Test
public void testCreateAndGetSyncgroups() throws Exception {

    Database db = createDatabase();
    DatabaseHandle.CollectionOptions opts = new DatabaseHandle.CollectionOptions();
    opts.withoutSyncgroup = true;
    Collection cxA = db.createCollection(opts.setPrefix("a"));
    Collection cxB = db.createCollection(opts.setPrefix("b"));
    Collection cxC = db.createCollection(opts.setWithoutSyncgroup(false).setPrefix("c"));
    assertNotNull(cxA);
    // Note, there's no userdata syncgroup since we set disableUserdataSyncgroup to true.
    assertTrue(idsMatch(getSyncgroupIds(db), Syncbase.getPersonalBlessingString(),
            ImmutableList.of("c")));
    db.syncgroup("sg1", ImmutableList.of(cxA));
    db.syncgroup("sg2", ImmutableList.of(cxA, cxB, cxC));
    assertThat(getSyncgroupIds(db)).containsExactly(
            new Id(Syncbase.getPersonalBlessingString(), cxC.getSyncgroup().getId().getName()),
            new Id(Syncbase.getPersonalBlessingString(), "sg1"),
            new Id(Syncbase.getPersonalBlessingString(), "sg2"));
}