### Question:
SoapBookmarkService extends AbstractService implements BookmarkService { @Override public WSBookmark bookmarkDocument(String sid, long docId) throws Exception { User user = validateSession(sid); WSDocument doc = checkDocumentAvailable(sid, docId); BookmarkDAO bDao = (BookmarkDAO) Context.get().getBean(BookmarkDAO.class); Bookmark bmark = bDao.findByUserIdAndDocId(user.getId(), docId); if (bmark == null) { bmark = new Bookmark(); bmark.setType(Bookmark.TYPE_DOCUMENT); bmark.setFileType(doc.getFileName()); bmark.setFileType(doc.getType()); bmark.setUserId(user.getId()); bmark.setTargetId(docId); bDao.store(bmark); } return WSBookmark.fromBookmark(bmark); }  @Override WSBookmark saveBookmark(String sid, WSBookmark bookmark); @Override WSBookmark bookmarkDocument(String sid, long docId); @Override WSBookmark bookmarkFolder(String sid, long folderId); @Override WSBookmark[] getBookmarks(String sid); @Override void deleteBookmark(String sid, long bookmarkId); @Override void unbookmarkDocument(String sid, long docId); @Override void unbookmarkFolder(String sid, long folderId);  }### Answer:
@Test public void testBookmarkDocument() throws Exception { bookmarkService.bookmarkDocument("", 1L); bookmarkService.bookmarkDocument("", 2L); WSBookmark[] bookmarks = bookmarkService.getBookmarks(""); Assert.assertEquals(2, bookmarks.length); try { bookmarkService.bookmarkDocument("", 3L); Assert.fail("the document doesn't exist, why exception was not raised."); } catch (Throwable t) { } }