Collection { public boolean exists() throws VError { return io.v.syncbase.internal.Collection.Exists(fullName, batchHandle); } Collection(String parentFullName, Id id, String batchHandle); Id id(); Permissions getPermissions(); void setPermissions(Permissions permissions); void create(Permissions permissions); void destroy(); boolean exists(); Row row(String key); byte[] get(String key); void put(String key, byte[] value); void delete(String key); void deleteRange(byte[] start, byte[] limit);  }
@Test public void exists() { Id dbId = new Id("idp:a:angrybirds", "core_exists_collection"); Id collectionId1 = new Id("...", "collection1"); Id collectionId2 = new Id("...", "collection2"); try { Database db = Service.database(dbId); db.create(anyDbPermissions()); BatchDatabase batchDb = db.beginBatch(null); Collection collection1 = batchDb.collection(collectionId1); collection1.create(anyCollectionPermissions()); assertFalse(db.collection(collectionId1).exists()); assertTrue(collection1.exists()); batchDb.commit(); assertTrue(db.collection(collectionId1).exists()); assertFalse(db.collection(collectionId2).exists()); } catch (VError vError) { vError.printStackTrace(); fail(vError.toString()); } }