function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shravani milshravani mil 

unable to cover below method in my test class any help is appreciated

private void UpdatingTRegions(Map<String,Opportunity>toUpdateT){
    
        
        Map<String,T__c> terrToTerrDetails= new Map<String,T__c>();

              OTriggerHandler.skipTriggerProcessing = true;
           
            for (T__c t: [select id, T_Id__c, R__c, Sub_R__c, Sub_R2__c from T__c where T_Id__c IN :toUpdateT.KeySet()]) {
                    terrToTerrDetails.put(t.T_Id__c, t);
                            }
            for(Opportunity o:toUpdateT.Values()){
                 o.R__c = terrToTerrDetails.get(o.tid).r__c;
                 o.S_R__c = terrToTerrDetails.get(o.tid).s_r__c;
                 o.S_R2__c = terrToTerrDetails.get(o.tid).s_r2__c;
            }
     
  }
Nagendra ChinchinadaNagendra Chinchinada
As it is a Private method, u might have called this method in some other Public method in same class. Try to cover that public method along with the line which calls UpdatingTRegions() method.I it must work. If it is still not covered,then paste ur class and test class code here, will go through code and modify it.
shravani milshravani mil
Hi Cant post all the code it contains lot of lines any other alternate idea
Nagendra ChinchinadaNagendra Chinchinada
Paste only the part of code that has the public method  which calls UpdatingTRegions() method. 
Rohit K SethiRohit K Sethi
Hi shravani mil,

You can call this method  directly to in test class by setting the "@TestVisible" . And When call pass Map which is required as parameter.

e.g. 
@TestVisible
private void UpdatingTRegions(Map<String,Opportunity>toUpdateT){}



If this post solves your problem kindly mark it as solution.
Thanks.