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
NikiG22NikiG22 

Extention Test Class

Hello Again - I know i really have issues with test classes. if any one has any tip sheets on the it would be awesome.

 

I need help on this Extention

Class:

public with sharing class ResumeExtension {

            List<Resume_Subscriptions__c> subscriptions { get; set; }

             public ResumeExtension( ApexPages.StandardSetController stdController ) {
               subscriptions = ( List<Resume_Subscriptions__c> ) stdcontroller.getSelected();
             
             }


            public PageReference newSave() { 

                        Set<Id> activeUserIds = new Set<Id>();

                        for( Resume_Subscriptions__c rs : subscriptions ) {

                             if(rs.Active__c && activeUserIds.contains( rs.User__c ) || rs.Active__c && rs.Active_Contact_RS_Count__c ==1 ) {
                             rs.Active__c = false;
                             rs.User__c.addError( 'You cannot have two active resumes with the same user. Your Changes have been saved, PLEASE CLICK DONE' );

                              } 
                             else if( rs.Active__c ) {
                             activeUserIds.add( rs.User__c );}

                       }

                       upsert subscriptions;

                        
                        return null ;   // change this to return the page you want.
                      
           }
}

 you help is much appriciated

Niki

Rajesh SriramuluRajesh Sriramulu

Hi

 

try this

 

@is Test

private class ResumeExtension_test{

static testmethod void ResumeExtension_test(){

 

ResumeExtension re = new ResumeExtension();

Resume_Subscriptions__c rsr= new Resume_Subscriptions__c();

//insert the values init and according to if conditions

re.newsave();

}}