I have written a simple SalesForce Trigger. I want to update the IsUnreadbyOwner field to False once a lead becomes unqualified (this happens as our users leave the leads in the queue).
My Trigger is:
trigger UnqualifiedLead on Lead (after update) {
for(Lead lead: Trigger.new)
{
if (lead.Status == 'Unqualified')
{
lead.IsUnreadByOwner = False;
}
}
}
My Test class, AFAIK should look like this:
@isTest
private class UnqualifiedLeadTest {
static testMethod void myUnitTest() {
// Setup the lead record
Lead lead = new Lead();
lead.LastName = 'last';
lead.FirstName = 'First';
lead.Company = 'Company';
lead.Status = 'Unqualified';
lead.IsUnreadByOwner = True;
insert lead;
}
}
However, I get a coverage error: 0% covered.
Where is my mistake?