BookmarksEntryAssetRenderer extends BaseJSPAssetRenderer<BookmarksEntry> implements TrashRenderer { @Override public boolean hasViewPermission(PermissionChecker permissionChecker) { try { return _bookmarksEntryModelResourcePermission.contains( permissionChecker, _entry, ActionKeys.VIEW); } catch (PortalException portalException) { if (_log.isDebugEnabled()) { _log.debug(portalException, portalException); } return false; } } BookmarksEntryAssetRenderer(
		BookmarksEntry entry,
		ModelResourcePermission<BookmarksEntry>
			bookmarksEntryModelResourcePermission); @Override BookmarksEntry getAssetObject(); @Override String getClassName(); @Override long getClassPK(); @Override long getGroupId(); @Override String getJspPath(
		HttpServletRequest httpServletRequest, String template); @Override String getPortletId(); @Override int getStatus(); @Override String getSummary(
		PortletRequest portletRequest, PortletResponse portletResponse); @Override String getTitle(Locale locale); @Override String getType(); @Override PortletURL getURLEdit(
		LiferayPortletRequest liferayPortletRequest,
		LiferayPortletResponse liferayPortletResponse); @Override String getURLView(
		LiferayPortletResponse liferayPortletResponse,
		WindowState windowState); @Override String getURLViewInContext(
		LiferayPortletRequest liferayPortletRequest,
		LiferayPortletResponse liferayPortletResponse,
		String noSuchEntryRedirect); @Override long getUserId(); @Override String getUserName(); @Override String getUuid(); @Override boolean hasEditPermission(PermissionChecker permissionChecker); @Override boolean hasViewPermission(PermissionChecker permissionChecker); @Override boolean include(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse, String template); @Override boolean isPrintable();  }
@Test public void testHasViewPermissionReturnsFalseOnFailure() throws Exception { Mockito.when( _modelResourcePermission.contains( Mockito.any(PermissionChecker.class), Mockito.any(BookmarksEntry.class), Mockito.anyString()) ).thenThrow( new PrincipalException() ); AssetRenderer<BookmarksEntry> assetRenderer = new BookmarksEntryAssetRenderer( _bookmarksEntry, _modelResourcePermission); Assert.assertFalse(assetRenderer.hasViewPermission(_permissionChecker)); }
@Test public void testHasViewPermissionReturnsFalseWhenUserDoesNotHavePermission() throws Exception { Mockito.when( _modelResourcePermission.contains( Mockito.any(PermissionChecker.class), Mockito.any(BookmarksEntry.class), Mockito.anyString()) ).thenReturn( false ); AssetRenderer<BookmarksEntry> assetRenderer = new BookmarksEntryAssetRenderer( _bookmarksEntry, _modelResourcePermission); Assert.assertFalse(assetRenderer.hasViewPermission(_permissionChecker)); }
@Test public void testHasViewPermissionReturnsTrueWhenUserHasPermission() throws Exception { Mockito.when( _modelResourcePermission.contains( Mockito.any(PermissionChecker.class), Mockito.any(BookmarksEntry.class), Mockito.anyString()) ).thenReturn( true ); AssetRenderer<BookmarksEntry> assetRenderer = new BookmarksEntryAssetRenderer( _bookmarksEntry, _modelResourcePermission); Assert.assertTrue(assetRenderer.hasViewPermission(_permissionChecker)); }