@Test
public void testCreateAndGetCollections() throws Exception {

    Database db = createDatabase();
    assertNotNull(db);
    DatabaseHandle.CollectionOptions opts = new DatabaseHandle.CollectionOptions().
            setWithoutSyncgroup(true).setPrefix("a");
    Collection cxA = db.createCollection(opts);
    assertNotNull(cxA);
    assertTrue(idsMatch(getCollectionIds(db), Syncbase.getPersonalBlessingString(),
            ImmutableList.of("a", Syncbase.USERDATA_NAME)));
    db.createCollection(opts.setPrefix("b"));
    assertTrue(idsMatch(getCollectionIds(db), Syncbase.getPersonalBlessingString(),
            ImmutableList.of("a", "b", Syncbase.USERDATA_NAME)));
    // Note, createDatabase() sets disableSyncgroupPublishing to true, so
    // db.createCollection(opts) is still a purely local operation.
    opts = new DatabaseHandle.CollectionOptions();
    db.createCollection(opts.setPrefix("c"));
    assertTrue(idsMatch(getCollectionIds(db), Syncbase.getPersonalBlessingString(),
            ImmutableList.of("a", "b", "c", Syncbase.USERDATA_NAME)));
    Collection secondCxA = db.createCollection(opts.setPrefix("a"));
    assertFalse(cxA.getId().equals(secondCxA.getId()));
    assertTrue(idsMatch(getCollectionIds(db), Syncbase.getPersonalBlessingString(),
            ImmutableList.of("a", "a", "b", "c", Syncbase.USERDATA_NAME)));
}