* an attachments associated with it.
* @throws Exception
*/
@Test
public void testDeleteFeedNewsAndAttachment() throws Exception {
NewsListener newsListener = null;
AttachmentListener attachmentListener = null;
try {
IFeed feed = fFactory.createFeed(null, new URL("http://www.foobar.com"));
FeedReference feedReference = new FeedReference(fDao.saveFeed(feed).getId());
/* Check News Added */
final INews news = fFactory.createNews(null, feedReference.resolve(), new Date());
news.setTitle("News Title");
final IAttachment attachment0 = fFactory.createAttachment(null, news);
attachment0.setUrl(new URI("http://www.attachment1.com"));
final IAttachment attachment1 = fFactory.createAttachment(null, news);
attachment1.setUrl(new URI("http://www.attachment1.com"));
fDao.saveFeed(feed);
NewsReference newsRef = new NewsReference(feed.getNews().get(0).getId());
AttachmentReference attachmentRef0 = new AttachmentReference(news.getAttachments().get(0).getId());
AttachmentReference attachmentRef1 = new AttachmentReference(news.getAttachments().get(1).getId());
final boolean[] newsDeleted = new boolean[1];
newsListener = new NewsListener() {
public void newsDeleted(Set<NewsEvent> events) {
for (NewsEvent event : events) {
assertFalse("Expected this Event to be no Root Event", event.isRoot());
if (event.getEntity().getTitle().equals(news.getTitle()))
newsDeleted[0] = true;