List listService;
@Test
public void testExecAsUserNoGroups() throws Exception {
final User entity = UserRepositoryTest.newUser(inc);
entity.setProfile(Profile.Editor);
entity.getAddresses().add(
new Address()
.setAddress("add1")
.setCity("city1")
.setCountry("country1")
.setState("state1")
.setZip("zip1"));
entity.getEmailAddresses().add("email2");
final User editor = _userRepo.save(entity);
_userRepo.save(UserRepositoryTest.newUser(inc));
final ServiceContext serviceContext = createServiceContext();
UserSession userSession = new UserSession();
userSession.loginAs(editor);
serviceContext.setUserSession(userSession);
final UserList response = listService.exec();
java.util.List<JAXBElement<? extends User>> records = response.getUsers();
assertEquals("Expected to find a record.", 1, records.size());
User user = records.get(0).getValue();
assertEquals("record/username", editor.getUsername(), user.getUsername());
assertEquals("record/primaryaddress/address", editor.getPrimaryAddress().getAddress(), user.getPrimaryAddress().getAddress());
assertEquals("record/profile", editor.getProfile().name(), user.getProfile().name());
assertEquals("record/emailaddresses/emailaddress", editor.getEmailAddresses().iterator().next(), user.getEmailAddresses().iterator().next());
}