diff --git a/modules/apps/journal/journal-test/src/testIntegration/java/com/liferay/journal/service/test/JournalArticleLocalServiceTest.java b/modules/apps/journal/journal-test/src/testIntegration/java/com/liferay/journal/service/test/JournalArticleLocalServiceTest.java index 52174ed8cebad7..daf1466fba33ed 100644 --- a/modules/apps/journal/journal-test/src/testIntegration/java/com/liferay/journal/service/test/JournalArticleLocalServiceTest.java +++ b/modules/apps/journal/journal-test/src/testIntegration/java/com/liferay/journal/service/test/JournalArticleLocalServiceTest.java @@ -180,6 +180,40 @@ public void testAddArticleWithExistingExternalReferenceCode() article.getArticleId(), true); } + @Test + public void testAddArticleWithoutFriendlyURLWithTitleWithTrailingSlashes() + throws Exception { + + ServiceContext serviceContext = + ServiceContextTestUtil.getServiceContext(); + + serviceContext.setCommand(Constants.ADD); + serviceContext.setLayoutFullURL("http://localhost"); + + Locale defaultLocale = _portal.getSiteDefaultLocale( + _group.getGroupId()); + + JournalArticle journalArticle = JournalTestUtil.addArticle( + null, _group.getGroupId(), + JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID, + JournalArticleConstants.CLASS_NAME_ID_DEFAULT, StringPool.BLANK, + true, + HashMapBuilder.put( + defaultLocale, "test///" + ).build(), + RandomTestUtil.randomLocaleStringMap(), Collections.emptyMap(), + RandomTestUtil.randomLocaleStringMap(), null, defaultLocale, null, + null, true, true, serviceContext); + + Map friendlyURLMap = journalArticle.getFriendlyURLMap(); + + Assert.assertFalse(friendlyURLMap.isEmpty()); + + for (Map.Entry entry : friendlyURLMap.entrySet()) { + Assert.assertEquals("test", entry.getValue()); + } + } + @Test public void testAddArticleWithURLWithURLWithConsecutiveSlashes() throws Exception {