### Question:
MongoStore implements ToDoStore { @Override public ToDo persist(ToDo td) { DBObject dbObj = convertToDbObject(td); coll.insert(dbObj); return createToDo(dbObj); } 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();  }### Answer:
@Test public void testPersist() { DBCollection coll = createMockCollection(); ToDo td = new ToDo(); td.setTitle("This is a test"); td.setId("aaaaaaaaaaaaaaaaaaaaaaa1"); expect(coll.insert(isA(DBObject.class))).andAnswer(new IAnswer<WriteResult>() { @Override public WriteResult answer() throws Throwable { DBObject obj = (DBObject)getCurrentArguments()[0]; obj.put("_id", new ObjectId("aaaaaaaaaaaaaaaaaaaaaaa1")); return null; } }); replay(coll); MongoStore store = new MongoStore(coll); assertEquals(td, store.persist(td)); verify(coll); }