Contact jane = new contact(FirstName='Jane',LastName='Smith', Email='jane.smith@example.com', Description='Contact of the day');
insert jane;
Contact Jane2 = new contact(FirstName='Jane',LastName='Smith', Email='jane.smith@example.com', Description='Prefers to be contacted by email.');
upsert jane2 contact.fields.Email;
System.assertEquals('prefers to be contacted by email.', [SELECT Description FROM Contact WHERE Id=:Jane.Id].Description);
Asked
Viewed
21 times
-4
prefers...
withPrefers...
.System.assertEquals(..)
checks for equality and in this case the two strings are not. – Jayant Das Nov 12 at 21:07