OrganizationalUnitController { public boolean canCreateOrgUnits() { return authorizationManager.authorize(OrganizationalUnit.RESOURCE_TYPE, OrganizationalUnitAction.CREATE, 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 userCanCreateOrganizationalUnitTest() { doReturn(true).when(organizationalUnitController).canCreateOrgUnits(); assertTrue(organizationalUnitController.canCreateOrgUnits()); }
@Test public void userCanNotCreateOrganizationalUnitsTest() { doReturn(false).when(organizationalUnitController).canCreateOrgUnits(); assertFalse(organizationalUnitController.canCreateOrgUnits()); }