SyncopeUser user = userDAO.find(1L);
USchema emailSchema = userSchemaDAO.find("email", USchema.class);
assertNotNull(emailSchema);
UAttr attribute = new UAttr();
attribute.setSchema(emailSchema);
attribute.setOwner(user);
Exception thrown = null;
try {
attribute.addValue("john.doe@gmail.com", AttributableUtil.getInstance(AttributableType.USER));
attribute.addValue("mario.rossi@gmail.com", AttributableUtil.getInstance(AttributableType.USER));
} catch (ValidationException e) {
LOG.error("Unexpected exception", e);
thrown = e;
}
assertNull("no validation exception expected here ", thrown);
try {
attribute.addValue("http://www.apache.org", AttributableUtil.getInstance(AttributableType.USER));
} catch (ValidationException e) {
thrown = e;
}
assertNotNull("validation exception expected here ", thrown);
}