• Nazira A
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi ,
In my test class trigger.isUpdate && isBefore is not coverd.Could any one help ?

Thanks ,
trigger IssuerUpdate on Issuer__c (before update)
{
    //uisng handler class to avoid recrisive
    if(trigger_handler.runisuuer())
    {    
        for(Issuer__c newIssuer : trigger.new)
        {
            //checking the status 
            if( newIssuer.Status__c == 'Approved')
            {
                if(trigger.isUpdate && trigger.isBefore)
                {
                    Issuer__c oldIssuer = trigger.oldMap.get(newIssuer.Id);
                    newIssuer.Ass1__c=  oldIssuer.Ass0__c;
                    newIssuer.DbtQ1__c= oldIssuer.DbtQ0__c;
                    newIssuer.DtE1__c = oldIssuer.DtE0__c;
                    newIssuer.Earn1__c= oldIssuer.Earn0__c;
                    newIssuer.Eqt1__c = oldIssuer.Eqt0__c;
                    newIssuer.MFRS1__c= oldIssuer.MFRS0__c; 
                    newIssuer.RA1__c  = oldIssuer.RA0__c; 
                    newIssuer.RevQ1__c= oldIssuer.RevQ0__c;
                    newIssuer.Rev1__c = oldIssuer.Rev0__c;
                    newIssuer.RE1__c  = oldIssuer.RE0__c; 
                    //'0' values null after update the Status Approved
                    newIssuer.RevQ0__c = null;
                    newIssuer.Rev0__c=null;
                    newIssuer.Ass0__c=null;
                    newIssuer.DbtQ0__c=null;
                    newIssuer.DtE0__c=null;
                    newIssuer.Earn0__c=null; 
                    newIssuer.Eqt0__c=null;
                    newIssuer.MFRS0__c=null;
                    newIssuer.RA0__c=null;
                    newIssuer.RE0__c=null;
                    
                    //RevQ---
                    newIssuer.RevQ2__c= oldIssuer.RevQ1__c;
                    newIssuer.RevQ3__c= oldIssuer.RevQ2__c;
                    newIssuer.RevQ4__c= oldIssuer.RevQ3__c;
                    
                    //Rev
                    newIssuer.Rev2__c= oldIssuer.Rev1__c;
                    newIssuer.Rev3__c= oldIssuer.Rev2__c;
                    newIssuer.Rev4__c= oldIssuer.Rev3__c;
                    //ass
                    newIssuer.Ass2__c= oldIssuer.Ass1__c;
                    newIssuer.Ass3__c= oldIssuer.Ass2__c;
                    newIssuer.Ass4__c= oldIssuer.Ass3__c;
                    //DbtQ0
                    newIssuer.DbtQ2__c= oldIssuer.DbtQ1__c;
                    newIssuer.DbtQ3__c= oldIssuer.DbtQ2__c;
                    newIssuer.DbtQ4__c= oldIssuer.DbtQ3__c;
                    //DtE1__c
                    newIssuer.DtE2__c= oldIssuer.DtE1__c;
                    newIssuer.DtE3__c= oldIssuer.DtE2__c;
                    newIssuer.DtE4__c= oldIssuer.DtE3__c;
                    //Earn0__c
                    newIssuer.Earn2__c= oldIssuer.Earn1__c;
                    newIssuer.Earn3__c= oldIssuer.Earn2__c;
                    newIssuer.Earn4__c= oldIssuer.Earn3__c;
                    //Earn0__c
                    newIssuer.Eqt2__c= oldIssuer.Eqt1__c;
                    newIssuer.Eqt3__c= oldIssuer.Eqt2__c;
                    newIssuer.Eqt4__c= oldIssuer.Eqt3__c;
                    //MFRS
                    newIssuer.MFRS2__c= oldIssuer.MFRS1__c;
                    newIssuer.MFRS3__c= oldIssuer.MFRS2__c;
                    newIssuer.MFRS4__c= oldIssuer.MFRS3__c;
                    //R01__c
                    newIssuer.RA2__c= oldIssuer.RA1__c;
                    newIssuer.RA3__c= oldIssuer.RA2__c;
                    newIssuer.RA4__c= oldIssuer.RA3__c;
                    //RE0__c
                    newIssuer.RE2__c= oldIssuer.RE1__c;
                    newIssuer.RE3__c= oldIssuer.RE2__c;
                    newIssuer.RE4__c= oldIssuer.RE3__c;
                }
            }
        }
    }
}

 
Hi ,
In my test class trigger.isUpdate && isBefore is not coverd.Could any one help ?

Thanks ,
trigger IssuerUpdate on Issuer__c (before update)
{
    //uisng handler class to avoid recrisive
    if(trigger_handler.runisuuer())
    {    
        for(Issuer__c newIssuer : trigger.new)
        {
            //checking the status 
            if( newIssuer.Status__c == 'Approved')
            {
                if(trigger.isUpdate && trigger.isBefore)
                {
                    Issuer__c oldIssuer = trigger.oldMap.get(newIssuer.Id);
                    newIssuer.Ass1__c=  oldIssuer.Ass0__c;
                    newIssuer.DbtQ1__c= oldIssuer.DbtQ0__c;
                    newIssuer.DtE1__c = oldIssuer.DtE0__c;
                    newIssuer.Earn1__c= oldIssuer.Earn0__c;
                    newIssuer.Eqt1__c = oldIssuer.Eqt0__c;
                    newIssuer.MFRS1__c= oldIssuer.MFRS0__c; 
                    newIssuer.RA1__c  = oldIssuer.RA0__c; 
                    newIssuer.RevQ1__c= oldIssuer.RevQ0__c;
                    newIssuer.Rev1__c = oldIssuer.Rev0__c;
                    newIssuer.RE1__c  = oldIssuer.RE0__c; 
                    //'0' values null after update the Status Approved
                    newIssuer.RevQ0__c = null;
                    newIssuer.Rev0__c=null;
                    newIssuer.Ass0__c=null;
                    newIssuer.DbtQ0__c=null;
                    newIssuer.DtE0__c=null;
                    newIssuer.Earn0__c=null; 
                    newIssuer.Eqt0__c=null;
                    newIssuer.MFRS0__c=null;
                    newIssuer.RA0__c=null;
                    newIssuer.RE0__c=null;
                    
                    //RevQ---
                    newIssuer.RevQ2__c= oldIssuer.RevQ1__c;
                    newIssuer.RevQ3__c= oldIssuer.RevQ2__c;
                    newIssuer.RevQ4__c= oldIssuer.RevQ3__c;
                    
                    //Rev
                    newIssuer.Rev2__c= oldIssuer.Rev1__c;
                    newIssuer.Rev3__c= oldIssuer.Rev2__c;
                    newIssuer.Rev4__c= oldIssuer.Rev3__c;
                    //ass
                    newIssuer.Ass2__c= oldIssuer.Ass1__c;
                    newIssuer.Ass3__c= oldIssuer.Ass2__c;
                    newIssuer.Ass4__c= oldIssuer.Ass3__c;
                    //DbtQ0
                    newIssuer.DbtQ2__c= oldIssuer.DbtQ1__c;
                    newIssuer.DbtQ3__c= oldIssuer.DbtQ2__c;
                    newIssuer.DbtQ4__c= oldIssuer.DbtQ3__c;
                    //DtE1__c
                    newIssuer.DtE2__c= oldIssuer.DtE1__c;
                    newIssuer.DtE3__c= oldIssuer.DtE2__c;
                    newIssuer.DtE4__c= oldIssuer.DtE3__c;
                    //Earn0__c
                    newIssuer.Earn2__c= oldIssuer.Earn1__c;
                    newIssuer.Earn3__c= oldIssuer.Earn2__c;
                    newIssuer.Earn4__c= oldIssuer.Earn3__c;
                    //Earn0__c
                    newIssuer.Eqt2__c= oldIssuer.Eqt1__c;
                    newIssuer.Eqt3__c= oldIssuer.Eqt2__c;
                    newIssuer.Eqt4__c= oldIssuer.Eqt3__c;
                    //MFRS
                    newIssuer.MFRS2__c= oldIssuer.MFRS1__c;
                    newIssuer.MFRS3__c= oldIssuer.MFRS2__c;
                    newIssuer.MFRS4__c= oldIssuer.MFRS3__c;
                    //R01__c
                    newIssuer.RA2__c= oldIssuer.RA1__c;
                    newIssuer.RA3__c= oldIssuer.RA2__c;
                    newIssuer.RA4__c= oldIssuer.RA3__c;
                    //RE0__c
                    newIssuer.RE2__c= oldIssuer.RE1__c;
                    newIssuer.RE3__c= oldIssuer.RE2__c;
                    newIssuer.RE4__c= oldIssuer.RE3__c;
                }
            }
        }
    }
}