+ Start a Discussion
DeepVDeepV 

Testclass help

Hi,

I'm new to coding and writing test classes:

Here is my class method :
There is an existiving test class. I need to do code coverage for the below method

  public boolean addProposedLegalNameb(){
     
      Date dtToday = Date.today();
     
        if(anewSubmission.REL_VS_ProposedLegalNameChange__c == null || anewSubmission.REL_VS_ProposedLegalNameChange__c == ''){
           ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter the Proposed Legal Name.')); 
           return false;
       }
       if(anewSubmission.REL_VS_LegalNameChangeReason__c == null || anewSubmission.REL_VS_LegalNameChangeReason__c == ''){
           ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter the Reason for Name Change.')); 
           return false;
       }
       if(anewSubmission.REL_VS_LegalNameChangeDate__c > dtToday){
           ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please DO NOT enter the future Date.')); 
          return false;
       }
       
        REL_VS_Submission__c obj = [select REL_VS_ProposedLegalNameChange__c, REL_VS_LegalNameChangeReason__c, REL_VS_LegalNameChangeDate__c, REL_VS_ConfirmLegalNameChange__c  from REL_VS_Submission__c where id = :anewSubmission.Id];            
        obj.REL_VS_ProposedLegalNameChange__c =  anewSubmission.REL_VS_ProposedLegalNameChange__c;
        obj.REL_VS_LegalNameChangeReason__c = anewSubmission.REL_VS_LegalNameChangeReason__c;
        obj.REL_VS_LegalNameChangeDate__c  = anewSubmission.REL_VS_LegalNameChangeDate__c; 
        obj.REL_VS_ConfirmLegalNameChange__c = 'Yes';
    
      partialSave();
           
       return true;
    }
Raj VakatiRaj Vakati
Can you give me complete code and any test class ?anewSubmission what is this object name