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
Pavan Kumar PPavan Kumar P 

Test Class Code Coverage - Apex

Hi,

Can anyone help me in test class code coverage for below mentioned part of code:

  List<T__c> tempT = [SELECT Id, Name, no__c, P__c FROM T__c WHERE no__c =: acc.no__c];
                ltc = new List<T__c>();

                for(T__c t : tempT)
                {
                    Boolean cF = false;
                    for(integer i = 0; i < ltc.size(); i++)
                    {
                        if(t.P__c.equalsIgnoreCase(ltc[i].P__c))
                        {
                            cF = true;
                            break;
                        }
                    }
                    if(!cF)
                    {
                        ltc.add(t);
                    }
                }
            }
            
            Set<String> stc = new Set<String>();

            for(T__c t : ltc)
            {
                if(!stc.contains(t.P__c))
                {
                    stc.add(t.P__c);
                }  
            }

            if(!stc.isEmpty())
            {
                MNO.add(new sOpt('','- None -'));
                for(String tc : stc)
                {
                    system.debug('TC P: '+tc);
                    MNO.add(new sOpt(tc,tc));
                }    
            }        


Thanks in advance.

Regards,
Pavan.