public void testRemoveBookMarkAndFeed() throws Exception {
{
IFolder folder = fFactory.createFolder(null, null, "Folder");
IFeed feed = createFeed("http://www.someurl.com");
feed = DynamicDAO.save(feed);
fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
IFolder savedFolder = DynamicDAO.save(folder);
IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
IFeed savedFeed = savedMark.getFeedLinkReference().resolve();
DynamicDAO.delete(savedMark);
assertNull("Feed must also be deleted since no more bookmarks reference it", DynamicDAO.load(IFeed.class, savedFeed.getId()));
}
{
IFolder folder = fFactory.createFolder(null, null, "AnotherFolder");
IFeed feed = createFeed("http://www.anotherurl.com");
feed = DynamicDAO.save(feed);
fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark1");
fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark2");
IFolder savedFolder = DynamicDAO.save(folder);
IBookMark savedMark1 = (IBookMark) savedFolder.getMarks().get(0);
IBookMark savedMark2 = (IBookMark) savedFolder.getMarks().get(1);
if (savedMark1.getName().equals("Mark2")) {
IBookMark tempMark = savedMark1;