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
Ganta SureshGanta Suresh 

Please help me what exactly this test class is totally doing.?

@isTest
public class Transaction_TDSaveTest
{
  static testmethod void upload()
  {
     RecordType rt=[Select Id,Name from RecordType where Name='TD Attestation' and SObjectType='ROD_Attestation__c'];
     
     ROD_Attestation__c rd=new ROD_Attestation__c();
     rd.TD1_Terms_Not_based_on_Ref__c='Yes';
     rd.TD2_Pmts_based_on_Pro_Rata__c='Yes';
     rd.TD3_Mgmt_Fee_Less_than_7_percent__c='Yes';
     rd.TD4_Outside_Agreements_Vetted__c='Yes';
     rd.RecordTypeId=rt.Id;
     insert rd;
     
     ApexPages.StandardController std=new ApexPages.StandardController(rd);
     Transaction_TDSave td=new Transaction_TDSave(std);
     td.upload();
  }
}
Best Answer chosen by Ganta Suresh
SubratSubrat (Salesforce Developers) 
Hello Ganta ,

This is a Test Class for Transaction_TDSaveTest , The test class has one test method called upload() which is Queriing a record type called "TD Attestation" for the ROD_Attestation__c object.

Creates a new ROD_Attestation__c record and sets some fields to "Yes" values. 

Inserts the ROD_Attestation__c record into the database.

Creates an instance of the ApexPages.StandardController class and passes in the ROD_Attestation__c record as a parameter.

Creates an instance of the Transaction_TDSave class and passes in the ApexPages.StandardController instance as a parameter.

Calls the upload() method on the Transaction_TDSave instance to test its functionality.


If the above information helps please mark this as Best Answer.
Thank you.

 

All Answers

SubratSubrat (Salesforce Developers) 
Hello Ganta ,

This is a Test Class for Transaction_TDSaveTest , The test class has one test method called upload() which is Queriing a record type called "TD Attestation" for the ROD_Attestation__c object.

Creates a new ROD_Attestation__c record and sets some fields to "Yes" values. 

Inserts the ROD_Attestation__c record into the database.

Creates an instance of the ApexPages.StandardController class and passes in the ROD_Attestation__c record as a parameter.

Creates an instance of the Transaction_TDSave class and passes in the ApexPages.StandardController instance as a parameter.

Calls the upload() method on the Transaction_TDSave instance to test its functionality.


If the above information helps please mark this as Best Answer.
Thank you.

 
This was selected as the best answer
Ganta SureshGanta Suresh
Let me know waht is this class doing ?
public class Transaction_TDSave {
    
    public ROD_Attestation__c rod{get;set;}
    public Id agrId {get;set;}
    public Id rt{get;set;}
    public Id facId{get;set;}
    
    public Transaction_TDSave(ApexPages.StandardController std)
    {
        this.rod=(ROD_Attestation__c)std.getRecord();
        this.agrId=ApexPages.currentpage().getParameters().get('ArrangementId');
        this.rt=ApexPages.currentpage().getParameters().get('rtId');
        this.facId=ApexPages.currentpage().getParameters().get('FacilityId');
    }
    
    public PageReference Upload()
    {
        RecordType rta=[Select Id,Name from RecordType where Name='TD Attestation' and SObjectType='ROD_Attestation__c'];
        ROD_Attestation__c rd=new ROD_Attestation__c();
        rd.TD1_Terms_Not_based_on_Ref__c=rod.TD1_Terms_Not_based_on_Ref__c;
        rd.TD2_Pmts_based_on_Pro_Rata__c=rod.TD2_Pmts_based_on_Pro_Rata__c;
        rd.TD3_Mgmt_Fee_Less_than_7_percent__c=rod.TD3_Mgmt_Fee_Less_than_7_percent__c;
        rd.TD4_Outside_Agreements_Vetted__c=rod.TD4_Outside_Agreements_Vetted__c;
        //rd.TD5_Non_Compliance_with_AKS__c=rod.TD5_Non_Compliance_with_AKS__c;
        rd.RecordTypeId=rta.Id;
        rd.Arrangement__c=agrId;
        //rd.Attestation_Status__c='Yes';
        insert rd;
        
        /*Eagle_Arrangement__c agr=[Select Id,TD_AKS_Checklist__c from Eagle_Arrangement__c where id=:agrId];
        
        if(rd.TD1_Terms_Not_based_on_Ref__c=='Yes' && rd.TD2_Pmts_based_on_Pro_Rata__c=='Yes' && rd.TD3_Mgmt_Fee_Less_than_7_percent__c=='Yes' && rd.TD4_Outside_Agreements_Vetted__c=='Yes')
        {
            agr.TD_AKS_Checklist__c=true;
        }
        else
        {
            agr.TD_AKS_Checklist__c=false;
        }
        
        update agr;*/
        
        PageReference pr =new PageReference ('/'+facId);
        return pr;
    }

}
Ganta SureshGanta Suresh
@Subrat 
SubratSubrat (Salesforce Developers) 
Hello Ganta ,

Can you please post this Class as a Seperate question to be addressed .

Thank you.