You need to sign in to do that
Don't have an account?

How i get code coverage for below if condition
Task[] restoreTaskOwner = new Task[0];
for(Task task : [SELECT Id, OwnerId, CustonField__c FROM Task Where WhatId IN :changedOwnerIds AND IsClosed = FALSE AND CustonField__c<> null]){
if (task.OwnerId <> tak.CustonField__c) {
task.OwnerId = task.CustonField__c;
restoreTaskOwner.add(tsk); } }
for(Task task : [SELECT Id, OwnerId, CustonField__c FROM Task Where WhatId IN :changedOwnerIds AND IsClosed = FALSE AND CustonField__c<> null]){
if (task.OwnerId <> tak.CustonField__c) {
task.OwnerId = task.CustonField__c;
restoreTaskOwner.add(tsk); } }
Use this in your test class:
Mark as best if it works.
Thanks.