}
@Test
public void getUsersByAuthorityName() {
String authorityName = "administrator";
Authority authority = repository.getByAuthority(authorityName);
assertNotNull(authority);
assertEquals(authorityName, authority.getAuthority());
assertTrue(authority.getUsers().isEmpty());
User newUser = new JpaUser();
newUser.setUsername("adminuser");
newUser.addAuthority(authority);
newUser = userRepository.save(newUser);
assertEquals(authority, newUser.getAuthorities().iterator().next());
authority = repository.getByAuthority(authorityName);
assertEquals(1, authority.getUsers().size());
}