@Test
public void testUpdate() {
String newName = "New contact type";
String newIcon = "/new/icon";
UserContactType type = ObjectsFactory.getDefaultUserContactType();
session.save(type);
type.setTypeName(newName);
type.setIcon(newIcon);
dao.saveOrUpdate(type);
session.flush();
session.evict(type);
UserContactType result = (UserContactType) session.get(UserContactType.class, type.getId());
assertNotNull(result);
assertEquals(type.getId(), result.getId());
assertEquals(type.getIcon(), result.getIcon());
assertEquals(type.getTypeName(), result.getTypeName());
assertEquals(type.getMask(), result.getMask());
assertEquals(type.getDisplayPattern(), result.getDisplayPattern());
assertEquals(type.getValidationPattern(), result.getValidationPattern());
}