Skip to content

Commit

Permalink
LPD-38847 add test to check that the behavior is consistent when addi…
Browse files Browse the repository at this point in the history
…ng and updating
  • Loading branch information
AliciaGarciaGarcia authored and brianchandotcom committed Oct 11, 2024
1 parent bf0fa9f commit 95c3cb5
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Locale, String> friendlyURLMap = journalArticle.getFriendlyURLMap();

Assert.assertFalse(friendlyURLMap.isEmpty());

for (Map.Entry<Locale, String> entry : friendlyURLMap.entrySet()) {
Assert.assertEquals("test", entry.getValue());
}
}

@Test
public void testAddArticleWithURLWithURLWithConsecutiveSlashes()
throws Exception {
Expand Down

0 comments on commit 95c3cb5

Please sign in to comment.