RolesAndPermissionsService implements ApplicationListener<ContextRefreshedEvent> { public List<RoleModel> getEditableRoles() { return roleDao.findAllEditableRoles(); }  void setRoleDao(RoleDAO roleDao); void setPermissionDao(PermissionDAO permissionDao); void setUsersService(UsersService usersService); void setRoleAssignmentDao(RoleAssignmentDAO roleAssignmentDao); @Override void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent); RoleModel createRole(RoleModel role); RoleAssignment createRoleAssignment(RoleAssignment roleAssignment); List<PermissionModel> getSchoolPermissions(); List<PermissionModel> getVaultPermissions(); RoleModel getRole(long id); RoleModel getIsAdmin(); RoleModel getDataOwner(); List<RoleModel> getEditableRoles(); List<RoleModel> getViewableRoles(); List<RoleModel> getSchoolRoles(); List<RoleModel> getVaultRoles(); RoleAssignment getRoleAssignment(long id); List<RoleAssignment> getRoleAssignmentsForSchool(String schoolId); List<RoleAssignment> getRoleAssignmentsForVault(String vaultId); User getVaultOwner(String vaultId); List<RoleAssignment> getRoleAssignmentsForUser(String userId); List<RoleAssignment> getRoleAssignmentsForRole(Long roleId); boolean hasAdminDashboardPermissions(String userId); Set<Permission> getUserPermissions(String userId); boolean hasPermission(String userId, Permission permission); boolean isAdminUser(String userId); RoleModel updateRole(RoleModel role); RoleAssignment updateRoleAssignment(RoleAssignment roleAssignment); void deleteRole(Long roleId); void deleteRoleAssignment(Long roleAssignmentId);  }
@Test public void getEditableRolesShouldReturnAllCustomRoles() { RoleModel schoolRole = aRole(RoleType.SCHOOL); RoleModel vaultRole = aRole(RoleType.VAULT); RoleModel adminRole = aRole(RoleType.ADMIN); given(mockRoleDao.findAll()).willReturn(Arrays.asList(schoolRole, vaultRole, adminRole)); List<RoleModel> actual = underTest.getEditableRoles(); List<RoleModel> expected = Arrays.asList(schoolRole, vaultRole); assertEquals(expected, actual); }