use of com.enonic.xp.portal.url.PageUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_pageUrlTest method createUrl_withId.
@Test
public void createUrl_withId() {
final Content content = ContentFixtures.newContent();
Mockito.when(this.contentService.getById(content.getId())).thenReturn(content);
final PageUrlParams params = new PageUrlParams().portalRequest(this.portalRequest).id("123456");
final String url = this.service.pageUrl(params);
assertEquals("/site/default/draft/a/b/mycontent", url);
}
use of com.enonic.xp.portal.url.PageUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_pageUrlTest method createUrl_withAbsolutePath.
@Test
public void createUrl_withAbsolutePath() {
final PageUrlParams params = new PageUrlParams().portalRequest(this.portalRequest).path("/a/b");
final String url = this.service.pageUrl(params);
assertEquals("/site/default/draft/a/b", url);
}
use of com.enonic.xp.portal.url.PageUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_pageUrlTest method createUrl_withId_notFound.
@Test
public void createUrl_withId_notFound() {
final Content content = ContentFixtures.newContent();
Mockito.when(this.contentService.getById(content.getId())).thenThrow(new ContentNotFoundException(content.getId(), Branch.from("draft")));
final PageUrlParams params = new PageUrlParams().portalRequest(this.portalRequest).id("123456");
final String url = this.service.pageUrl(params);
assertEquals("/site/default/draft/context/path/_/error/404?message=Content+with+id+%5B123456%5D+was+not+found+in+branch+%5Bdraft%5D", url);
}
use of com.enonic.xp.portal.url.PageUrlParams in project xp by enonic.
the class PortalUrlServiceImpl_pageUrlTest method createUrl_withIdAndPath.
@Test
public void createUrl_withIdAndPath() {
final Content content = ContentFixtures.newContent();
Mockito.when(this.contentService.getById(content.getId())).thenReturn(content);
final PageUrlParams params = new PageUrlParams().portalRequest(this.portalRequest).id("123456").path("/a/b");
final String url = this.service.pageUrl(params);
assertEquals("/site/default/draft/a/b/mycontent", url);
}
Aggregations