}
}
public void databaseTests() {
DBCollection<Map<String, Object>> collection = context.openCollection("foo");
long initialCount = collection.query(new Count(), new Query());
collection.save(doc);
List<Map<String, Object>> results = collection.query(idQuery);
specify(results.size(), does.equal(1));
specify(results.get(0).get("foo"), does.equal("bar"));
collection.query(new Distinct<List<Object>>("foo"), new Query()).contains("bar");
specify(collection.query(new Count(), new Query()), does.equal(initialCount + 1));
runGroup(collection);
specify(collection.query(new Count(), idQuery), does.equal(1));
collection.delete(idQuery);
specify(collection.query(idQuery).size(), does.equal(0));
specify(context.dbAdmin().getCollectionNames(), containsExactly("foo"));
specify(collection.query(new Count(), new Query()), does.equal(initialCount));
}