Reputation: 68
Why is this error thrown? I'm expecting it to pass.
Note : Without this assertion the code works perfectly fine.
Upvotes: 0
Views: 144
Reputation: 526
I would try explicitly requesting the Last Name field in the SELECT clause as seen below:
for(Contact contact : [SELECT Id LastName, Name FROM Contact]){
System.assertEquals(lastName, contact.LastName);
}
FYI, it would have been easier to answer this question if the code was in text and not an image.
Upvotes: 2