@Test public void testChildLayoutFriendlyURL() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(); UserGroup userGroup = UserGroupLocalServiceUtil.addUserGroup( TestPropsValues.getUserId(), TestPropsValues.getCompanyId(), "Test " + RandomTestUtil.nextInt(), StringPool.BLANK, serviceContext); _group = userGroup.getGroup(); Layout homeLayout = LayoutLocalServiceUtil.addLayout( serviceContext.getUserId(), _group.getGroupId(), true, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, "Home", StringPool.BLANK, StringPool.BLANK, LayoutConstants.TYPE_PORTLET, false, StringPool.BLANK, serviceContext); LayoutLocalServiceUtil.addLayout( serviceContext.getUserId(), _group.getGroupId(), true, homeLayout.getLayoutId(), "Child Layout", StringPool.BLANK, StringPool.BLANK, LayoutConstants.TYPE_PORTLET, false, StringPool.BLANK, serviceContext); String actualURL = PortalUtil.getActualURL( userGroup.getGroup().getGroupId(), true, Portal.PATH_MAIN, "/~/" + userGroup.getUserGroupId() + "/child-layout", new HashMap<String, String[]>(), getRequestContext()); Assert.assertNotNull(actualURL); try { PortalUtil.getActualURL( userGroup.getGroup().getGroupId(), true, Portal.PATH_MAIN, "/~/" + userGroup.getUserGroupId() + "/non-existing-child-layout", new HashMap<String, String[]>(), getRequestContext()); Assert.fail(); } catch (NoSuchLayoutException nsle) { } }