userRoleDao.setUserRoles( mainTenant_1, USER_2, new String[] { ROLE_1, ROLE_2, ROLE_3 } );
UserRoleDaoUserDetailsService userDetailsService = new UserRoleDaoUserDetailsService();
userDetailsService.setUserRoleDao( userRoleDao );
userDetailsService.setDefaultRole( tenantAuthenticatedRoleName );
UserDetails userFromService = userDetailsService.loadUserByUsername( USER_2 );
assertTrue( userFromService.getUsername().equals( USER_2 ) );
assertTrue( userFromService.getPassword() != null );
assertTrue( userFromService.isEnabled() == true );
assertTrue( userFromService.getAuthorities().length == 4 );
assertTrue( userFromService.getAuthorities()[0].getAuthority().equals( ROLE_0 )
|| userFromService.getAuthorities()[0].getAuthority().equals( ROLE_3 )
|| userFromService.getAuthorities()[0].getAuthority().equals( ROLE_2 )
|| userFromService.getAuthorities()[0].getAuthority().equals( ROLE_1 ) );
assertTrue( userFromService.getAuthorities()[1].getAuthority().equals( ROLE_0 )
|| userFromService.getAuthorities()[1].getAuthority().equals( ROLE_3 )
|| userFromService.getAuthorities()[1].getAuthority().equals( ROLE_2 )
|| userFromService.getAuthorities()[1].getAuthority().equals( ROLE_1 ) );
assertTrue( userFromService.getAuthorities()[2].getAuthority().equals( ROLE_0 )
|| userFromService.getAuthorities()[2].getAuthority().equals( ROLE_3 )
|| userFromService.getAuthorities()[2].getAuthority().equals( ROLE_2 )
|| userFromService.getAuthorities()[2].getAuthority().equals( ROLE_1 ) );
assertTrue( userFromService.getAuthorities()[3].getAuthority().equals( ROLE_0 )
|| userFromService.getAuthorities()[3].getAuthority().equals( ROLE_3 )
|| userFromService.getAuthorities()[3].getAuthority().equals( ROLE_2 )
|| userFromService.getAuthorities()[3].getAuthority().equals( ROLE_1 ) );
cleanupUserAndRoles( mainTenant_1 );
}