protected PublishEventTO createPublishEventTO(
     SubscriptionContext subsContext,
     Long dialogElementsResourceableId,
     Identity identity,
     DialogElement dialogElement,
     EventType eventType) {
   if (EventType.NO_PUBLISH.equals(eventType) || subsContext == null) {
     return PublishEventTO.getNoPublishInstance();
   }
   ContextInfo contextInfo =
       notificationSubscriptionContextFactory.createContextInfoFrom(subsContext);
   PublishEventTO publishEventTO =
       PublishEventTO.getValidInstance(
           contextInfo.getContextType(),
           contextInfo.contextId(),
           subsContext.getContextTitle(),
           contextInfo.subContextId(),
           DialogElementsNotificationTypeHandler.DIALOGELEMENTS_SOURCE_TYPE,
           dialogElementsResourceableId,
           subsContext.getSourceTitle(),
           dialogElement.getFilename(),
           identity,
           eventType);
   publishEventTO.setSourceEntryId(dialogElement.getFilename());
   return publishEventTO;
 }
 /** Test method add */
 @Test
 public void testAdd() {
   final Item newEpisode = new Item();
   newEpisode.setGuid(CodeHelper.getGlobalForeverUniqueID());
   newEpisode.setTitle("This is my new Item");
   // Count episodes before
   final int initialCount = feed.getItems().size();
   feedManager.addItem(newEpisode, null, feed, PublishEventTO.getNoPublishInstance());
   // re-read feed and count episodes
   feed = feedManager.getFeed(feed);
   final int newCount = feed.getItems().size();
   // Compare
   assertEquals(initialCount + 1, newCount);
 }
  /** @see junit.framework.TestCase#setUp() */
  @Before
  public void setup() {
    setupMocking();

    // Create a feed that can be read, updated or deleted.
    final OLATResourceable podcastResource = feedManager.createPodcastResource();
    feed = feedManager.getFeed(podcastResource);
    feed.setTitle(PODCAST_TITLE);
    feedManager.updateFeedMetadata(feed);

    // Add an episode
    // A feed can only be edited when it is an internal feed (meaning that
    // it is made within OLAT). Obviously, external feeds cannot be changed.
    final Item item = new Item();
    item.setTitle("My Test Item");
    feed = feedManager.updateFeedMode(Boolean.FALSE, feed);
    feedManager.addItem(item, null, feed, PublishEventTO.getNoPublishInstance());
  }