You need to sign in to do that
Don't have an account?
Santosh Shah 4
Not able to pass test code coverage
I'm, just getting 63% code coverage..not able to incerase c..can any one help me
Test class:
Test class:
@isTest public class TestOpportunityContactRoleHandler { @isTest static void TestBeforeInsertMethod(){ Contact ConRec= new Contact(); ConRec.FirstName = 'Test'; ConRec.LastName = 'Test'; insert ConRec; Opportunity opps = new opportunity(); opps.Name='test'; opps.StageName='Processing'; insert opps; OpportunityContactRole oppRole = new OpportunityContactRole(); oppRole.Role='ROLE1'; oppRole.ContactId = ConRec.Id; oppRole.OpportunityId = opps.Id; insert oppRole; }
In your code, you have these are "lists" of things, so your SELECT statement will need to use IN not = (equals). so change the WHERE to
regards
Andrew
the code logic reads OK - how are you invoking the class? before or after trigger?
If you are invoking it in a before trigger, then insert a second OCR record.
Thought being is that if it is a before insert trigger, the OCR will not exist in the database until after the save event occurs.
regards
Andrew