}
@Test
public void issue147() {
// 1. create an user without role nor resources
UserTO userTO = getUniqueSampleTO("147@t.com");
userTO = createUser(userTO);
assertNotNull(userTO);
assertTrue(userTO.getResources().isEmpty());
// 2. try to update by adding a resource, but no password: must fail
UserMod userMod = new UserMod();
userMod.setId(userTO.getId());
userMod.addResourceToBeAdded("ws-target-resource-2");
SyncopeClientException sce = null;
try {
userService.update(userMod.getId(), userMod);
} catch (SyncopeClientCompositeErrorException scce) {
sce = scce.getException(SyncopeClientExceptionType.RequiredValuesMissing);
}
assertNotNull(sce);
// 3. provide password: now update must work
userMod.setPassword("newPassword");
userTO = userService.update(userMod.getId(), userMod);
assertNotNull(userTO);
assertEquals(1, userTO.getResources().size());
}