UserRoleDaoService { public RoleListWrapper getRoles() throws UncategorizedUserRoleDaoException { return new RoleListWrapper( getRoleDao().getRoles() ); }  UserListWrapper getUsers(); RoleListWrapper getRolesForUser( String user ); void assignRolesToUser( String userName, String roleNames ); void removeRolesFromUser( String userName, String roleNames ); void createRole( String roleName ); RoleListWrapper getRoles(); UserListWrapper getRoleMembers( String roleName ); void createUser( User user ); void changeUserPassword( final String userName, final String newPass, String oldPass ); void deleteUsers( String userNames ); void deleteRoles( String roleNames ); SystemRolesMap getRoleBindingStruct( String locale ); void setLogicalRoles( LogicalRoleAssignments roleAssignments ); void updatePassword( User user, String administratorPassword ); void updatePassword( User user ); static final String PUC_USER_PASSWORD_LENGTH; static final String PUC_USER_PASSWORD_REQUIRE_SPECIAL_CHARACTER; }
@Test public void testGetRoles() throws Exception { List<IPentahoRole> roleList = new ArrayList<>(); IUserRoleDao roleDao = mock( IUserRoleDao.class ); when( roleDao.getRoles() ).thenReturn( roleList ); PentahoSystem.registerObject( roleDao ); IPentahoRole role = mock( IPentahoRole.class ); when( role.getName() ).thenReturn( "testRole" ); roleList.add( role ); RoleListWrapper wrapRoleList = new RoleListWrapper( roleList ); assertEquals( wrapRoleList.getRoles(), userRoleService.getRoles().getRoles() ); }