@Test public void testGetAllAuthoritiesSorted() throws Exception { dao.setRoleComparator(new DefaultRoleComparator()); List<String> authorities = dao.getAllRoles(); if (logger.isDebugEnabled()) { logger.debug("testGetAllAuthoritiesSorted(): Authorities: " + authorities); // $NON-NLS-1$ } assertTrue( authorities.indexOf(new GrantedAuthorityImpl("ROLE_THREE")) < authorities.indexOf(new GrantedAuthorityImpl("ROLE_TWO"))); }
@Test public void testGetAllAuthorities() throws Exception { List<String> allAuthorities = dao.getAllRoles(); assertTrue( "Authority list should contain three roles", allAuthorities.size() == 3); // $NON-NLS-1$ for (String role : allAuthorities) { if (logger.isDebugEnabled()) { logger.debug("testGetAllAuthorities(): Authority: " + role); // $NON-NLS-1$ } assertTrue( "Authority name must be ROLE_ONE, ROLE_TWO or ROLE_THREE", ( //$NON-NLS-1$ role.equals("ROLE_ONE") // $NON-NLS-1$ || role.equals("ROLE_TWO") // $NON-NLS-1$ || role.equals("ROLE_THREE") // $NON-NLS-1$ )); } }