DepotAdminMembershipsDisplayContext { public int getDepotGroupsCount() throws PortalException { List<Group> groups = _getDepotGroups(); return groups.size(); } DepotAdminMembershipsDisplayContext(
			ItemSelector itemSelector,
			LiferayPortletRequest liferayPortletRequest,
			LiferayPortletResponse liferayPortletResponse); List<Group> getDepotGroups(int start, int end); int getDepotGroupsCount(); String getItemSelectorEventName(); PortletURL getItemSelectorURL(); String getLabel(); String getRoles(Group group); User getUser(); boolean isDeletable(); boolean isSelectable();  }
@Test public void testGetDepotsGroupCountWithDepotAndCompanyAdmin() throws Exception { Group group = getDepotGroup(); Mockito.when( _user.getGroups() ).thenReturn( Collections.singletonList(group) ); DepotAdminMembershipsDisplayContext depotAdminMembershipsDisplayContext = new DepotAdminMembershipsDisplayContext( Mockito.mock(ItemSelector.class), _getLiferayPortletRequest( new ThemeDisplayBuilder().withPermissionChecker( getPermissionCheckerWithCompanyAdmin() ).build()), null); Assert.assertEquals( 1, depotAdminMembershipsDisplayContext.getDepotGroupsCount()); }
@Test public void testGetDepotsGroupCountWithoutDepot() throws Exception { Mockito.when( _user.getGroups() ).thenReturn( Collections.emptyList() ); DepotAdminMembershipsDisplayContext depotAdminMembershipsDisplayContext = new DepotAdminMembershipsDisplayContext( Mockito.mock(ItemSelector.class), _getLiferayPortletRequest( new ThemeDisplayBuilder().withPermissionChecker( getPermissionCheckerWithCompanyAdmin() ).build()), null); Assert.assertEquals( 0, depotAdminMembershipsDisplayContext.getDepotGroupsCount()); }