BatchDatabase extends DatabaseHandle { @Override public Collection createCollection(CollectionOptions opts) throws SyncbaseException { String name = opts.prefix + "_" + UUID.randomUUID().toString().replaceAll("-", ""); if (!opts.withoutSyncgroup) { throw new IllegalArgumentException("Cannot create syncgroup in a batch"); } Collection res = getCollection(new Id(Syncbase.getPersonalBlessingString(), name)); res.createIfMissing(); return res; } BatchDatabase(io.v.syncbase.core.BatchDatabase coreBatchDatabase); @Override Collection createCollection(CollectionOptions opts); void commit(); void abort();  }
@Test public void attemptCreateSyncgroupWithinBatch() throws SyncbaseException, ExecutionException, InterruptedException { BatchDatabase batch = Syncbase.database().beginBatch(new Database.BatchOptions()); thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Cannot create syncgroup in a batch"); batch.createCollection(new CollectionOptions()); }