@Test
public void testHasProfile() throws Exception {

    final User user1 = newUser(_inc);
    user1.setProfile(Profile.RegisteredUser);
    _userRepo.save(user1);
    final User user2 = newUser(_inc);
    user2.setProfile(Profile.Reviewer);
    _userRepo.save(user2);
    List<User> found = _userRepo.findAll(hasProfile(Profile.RegisteredUser));
    assertEquals(1, found.size());
    assertEquals(user1.getId(), found.get(0).getId());
    found = _userRepo.findAll(hasProfile(Profile.Reviewer));
    assertEquals(1, found.size());
    assertEquals(user2.getId(), found.get(0).getId());
}