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
jayaramu Talapalajayaramu Talapala 

can any one can help for this?

I am new to salesforce, Could you please help me to write test class for below code

 for(Release__c rel : releaseLst){
                for(Material__c mat : rel.Materials__r){
                    if(mat.Material_Status__c == 'Draft' && Date.TODAY() < rel.Internal_Announce_Date__c && mat.Format_Description__c != null){ 
                        if(mat.Format_Description__c != 'EST (ELECTRONIC SELL THRU)' && mat.Format_Description__c != 'DVD RENTAL' && mat.Format_Description__c != 'BD RENTAL' && mat.Format_Description__c != 'VOD' && mat.Format_Description__c != 'HD VOD'){
                            if(rel.Street_Date__c != null){
                                mat.Street_Date__c = rel.Street_Date__c;
                            }
                            if(rel.First_Theatrical_Date__c != null){
                                mat.Theatrical_Release_Date__c = rel.First_Theatrical_Date__c;
                            }
                            if(rel.Internal_Announce_Date__c != null){
                                mat.Internal_Announce_Date__c = rel.Internal_Announce_Date__c;
                            }
                            if(rel.Trade_Solicitation_Date__c != null){
                                mat.Trade_Solicitation_Date__c = rel.Trade_Solicitation_Date__c;
                            }
                            if(rel.In_Plant_Date__c != null){
                                mat.In_Plant_Date__c = rel.In_Plant_Date__c;
                            }
                            if(rel.Pre_Order_Close_Date__c != null){
                                mat.Pre_Order_Close_Date__c = rel.Pre_Order_Close_Date__c;
                            }
BJ SAGABJ SAGA
Hi Jayaramu Talapala,

Create a test apex class, declare Release__c and Material__c  objects, fill all the conditions given in if loop, insert the records. Now call the Apex method in the test class. Check for code coverage. Simple....

If you cant understand let me know i will post the code. Before making reply try by yourself.

Thanks & regards

SAGA BJ