@Test public void testDelete() { ToDo td = new ToDo(); td.setId("aaaaaaaaaaaaaaaaaaaaaaa2"); td.setTitle("this is a test"); BasicDBObject dbObj = new BasicDBObject(); dbObj.put("_id", new ObjectId("aaaaaaaaaaaaaaaaaaaaaaa2")); DBCollection coll = createMockCollection(); expect(coll.remove(eq(dbObj))).andReturn(null); replay(coll); MongoStore store = new MongoStore(coll); store.delete("aaaaaaaaaaaaaaaaaaaaaaa2"); verify(coll); }
@Override public void delete(String id) { DBObject query = new BasicDBObject("_id", new ObjectId(id)); coll.remove(query); }
MongoStore implements ToDoStore { @Override public void delete(String id) { DBObject query = new BasicDBObject("_id", new ObjectId(id)); coll.remove(query); } }
MongoStore implements ToDoStore { @Override public void delete(String id) { DBObject query = new BasicDBObject("_id", new ObjectId(id)); coll.remove(query); } MongoStore(DBCollection coll); }
MongoStore implements ToDoStore { @Override public void delete(String id) { DBObject query = new BasicDBObject("_id", new ObjectId(id)); coll.remove(query); } MongoStore(DBCollection coll); @Override Collection<ToDo> getAll(); @Override ToDo get(String id); @Override ToDo persist(ToDo td); @Override ToDo update(String id, ToDo td); @Override void delete(String id); @Override int count(); }
MongoStore implements ToDoStore { @Override public void delete(String id) { DBObject query = new BasicDBObject("_id", new ObjectId(id)); coll.remove(query); } MongoStore(DBCollection coll); @Override Collection<ToDo> getAll(); @Override ToDo get(String id); @Override ToDo persist(ToDo td); @Override ToDo update(String id, ToDo td); @Override void delete(String id); @Override int count();  }