@Test public void testEmailEntryUpdatedNotSentIfNotSpecified() throws Exception { BlogsEntry entry = BlogsTestUtil.addEntry(_group, true); BlogsEntryLocalServiceUtil.subscribe(_user.getUserId(), _group.getGroupId()); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(entry.getGroupId()); serviceContext.setAttribute("emailEntryUpdatedComment", "This entry was updated."); BlogsTestUtil.updateEntry(entry, StringUtil.randomString(), true, serviceContext); Assert.assertEquals(0, MailServiceTestUtil.getInboxSize()); }
@Test public void testEmailEntryUpdatedSentWithEmptyEmailEntryUpdatedComment() throws Exception { setUpBlogsSettings(); BlogsEntry entry = BlogsTestUtil.addEntry(_group, true); BlogsEntryLocalServiceUtil.subscribe(_user.getUserId(), _group.getGroupId()); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(entry.getGroupId()); serviceContext.setAttribute("sendEmailEntryUpdated", Boolean.TRUE.toString()); BlogsTestUtil.updateEntry(entry, StringUtil.randomString(), true, serviceContext); MailMessage message = MailServiceTestUtil.getLastMailMessage(); Assert.assertEquals(message.getBody(), StringPool.NEW_LINE); }