OrganizationalUnitController { public boolean canReadOrgUnits() { return authorizationManager.authorize(OrganizationalUnit.RESOURCE_TYPE, OrganizationalUnitAction.READ, user); } @Inject  OrganizationalUnitController(AuthorizationManager authorizationManager,
                                        User user); boolean canCreateOrgUnits(); boolean canReadOrgUnits(); boolean canReadOrgUnit(final OrganizationalUnit organizationalUnit); boolean canUpdateOrgUnit(OrganizationalUnit organizationalUnit); boolean canDeleteOrgUnit(OrganizationalUnit organizationalUnit); static final String ORG_UNIT_TYPE; static final String ORG_UNIT_CREATE; static final String ORG_UNIT_READ; static final String ORG_UNIT_UPDATE; static final String ORG_UNIT_DELETE; }
@Test public void userCanReadOrganizationalUnitsTest() { doReturn(true).when(organizationalUnitController).canReadOrgUnits(); assertTrue(organizationalUnitController.canReadOrgUnits()); }
@Test public void userCanNotReadOrganizationalUnitsTest() { doReturn(false).when(organizationalUnitController).canReadOrgUnits(); assertFalse(organizationalUnitController.canReadOrgUnits()); }