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

Test Class for Trigger..Urgent
if(Trigger.isBefore){
if(Trigger.IsUpdate ){
if(checkRecursive.runOnce()){
for(Account acc1:Trigger.New){
if(string.isNotBlank(acc1.Mobile_NO_Contact__c) ){
if(acc1.Mobile_NO_Contact__c.isNumeric()){
if(acc1.Mobile_NO_Contact__c!=Trigger.oldMap.get(acc1.id).Mobile_NO_Contact__c){
acclists1.add(acc1);system.debug('acclist@@@@@@'+acclists1);
}
}
else{
acc1.addError('Please enter the valid mobile number');
}
}
}// end of for loop for modification of mobile number.
if(!acclists1.isEmpty()){
accountTriggerHandler.beforeUpdateMethod(acclists1);
}
for(Account acc2:Trigger.New){
if(string.isNotBlank(acc2.Mobile_NO_Contact__c) ){
if(acc2.Present_No_of_Years_in_Current_City__c!=null && (Trigger.oldMap.get(acc2.id).Present_No_of_Years_in_Current_City__c==null)){
if(acc2.Mobile_NO_Contact__c.isNumeric()){
acclists2.add(acc2);system.debug('acclist@@@@@@'+acclists2);
}
else{
acc2.addError('Please enter the valid mobile number');
}
}
}
}// end of for loop.
if(!acclists2.isEmpty()){
accountTriggerHandler.beforeinsertMethod(acclists2);
}
}// end if loop for checking profile
for(Account acc:Trigger.new){
system.debug('acc.Mobile_NO_Contact__c'+acc.Mobile_NO_Contact__c);
system.debug('acc.Customer_Id__c'+acc.Customer_Id__c);
system.debug('acc.zone__c'+acc.zone__c);
system.debug('Branch_Name__c'+acc.Branch_Name__r.Mobile_Flagging__c);
system.debug('Branch_Name__c'+acc.Branch_Name__c);
if(string.isNotBlank(acc.Mobile_NO_Contact__c) ){
if(acc.Mobile_NO_Contact__c.isNumeric()){
acclist.add(acc);system.debug('acclist@@@@@@'+acclist);
accountIds.add(acc.Id);
branchIds.add(acc.Branch_Name__c);
}
else{
acc.zone__c='Invalide';
}
}
}
if(!acclist.isEmpty()){
accountTriggerHandler.beforeupdate(acclist);// Passing parameters to handler class of Trigger
}// end of one time updation
}// end of recursion.
}// end of update.
}//end of isBefore
Bold lines code not covering plz help me out
Thnaks in advanced.
if(Trigger.IsUpdate ){
if(checkRecursive.runOnce()){
for(Account acc1:Trigger.New){
if(string.isNotBlank(acc1.Mobile_NO_Contact__c) ){
if(acc1.Mobile_NO_Contact__c.isNumeric()){
if(acc1.Mobile_NO_Contact__c!=Trigger.oldMap.get(acc1.id).Mobile_NO_Contact__c){
acclists1.add(acc1);system.debug('acclist@@@@@@'+acclists1);
}
}
else{
acc1.addError('Please enter the valid mobile number');
}
}
}// end of for loop for modification of mobile number.
if(!acclists1.isEmpty()){
accountTriggerHandler.beforeUpdateMethod(acclists1);
}
for(Account acc2:Trigger.New){
if(string.isNotBlank(acc2.Mobile_NO_Contact__c) ){
if(acc2.Present_No_of_Years_in_Current_City__c!=null && (Trigger.oldMap.get(acc2.id).Present_No_of_Years_in_Current_City__c==null)){
if(acc2.Mobile_NO_Contact__c.isNumeric()){
acclists2.add(acc2);system.debug('acclist@@@@@@'+acclists2);
}
else{
acc2.addError('Please enter the valid mobile number');
}
}
}
}// end of for loop.
if(!acclists2.isEmpty()){
accountTriggerHandler.beforeinsertMethod(acclists2);
}
}// end if loop for checking profile
for(Account acc:Trigger.new){
system.debug('acc.Mobile_NO_Contact__c'+acc.Mobile_NO_Contact__c);
system.debug('acc.Customer_Id__c'+acc.Customer_Id__c);
system.debug('acc.zone__c'+acc.zone__c);
system.debug('Branch_Name__c'+acc.Branch_Name__r.Mobile_Flagging__c);
system.debug('Branch_Name__c'+acc.Branch_Name__c);
if(string.isNotBlank(acc.Mobile_NO_Contact__c) ){
if(acc.Mobile_NO_Contact__c.isNumeric()){
acclist.add(acc);system.debug('acclist@@@@@@'+acclist);
accountIds.add(acc.Id);
branchIds.add(acc.Branch_Name__c);
}
else{
acc.zone__c='Invalide';
}
}
}
if(!acclist.isEmpty()){
accountTriggerHandler.beforeupdate(acclist);// Passing parameters to handler class of Trigger
}// end of one time updation
}// end of recursion.
}// end of update.
}//end of isBefore
Bold lines code not covering plz help me out
Thnaks in advanced.
In this case you need to create an account Record in your test mathos and update that in the same method .
when you will update you need to change the Mobile_NO_Contact__c value so that your trigger will cover .
For reference you can check belwo link it wil help !!
http://manojjena20.blogspot.in/2015/06/tips-and-tricks-for-test-class.html
As i m not sure what all mandatory fields are there in your account .
Try from your end and post incase any issue we will help you .
Thanks
Manoj