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
chiranjib routchiranjib rout 

please suggest for this test class

hii here i have written on apex class ,i am new to test class,please suggest test class for it, 

 public PageReference attachedTalentsToJobs()
    {
        try
        {
            
            List<Contact> cand = new List<Contact>();
            SCSCHAMPS__Job__c jobRec = new SCSCHAMPS__Job__c();
            jobRec = [SELECT SCSCHAMPS__Account_Manager__c,SCSCHAMPS__Account__c,SCSCHAMPS__Date_of_Posting__c,
                       SCSCHAMPS__Desired_Skills__c,SCSCHAMPS__Expected_Start_Date__c,SCSCHAMPS__Hiring_Manager_Name__c,SCSCHAMPS__Hiring_Manager__c,Id,
                       SCSCHAMPS__Job_Title__c,Name,SCSCHAMPS__Recruiter__c,SCSCHAMPS__Skill_Matched__c,SCSCHAMPS__Stage__c,SCSCHAMPS__Talent_Search__c,SCSCHAMPS__Travel_Per__c  
                       FROM SCSCHAMPS__Job__c where id=:jobId];
            List<SCSCHAMPS__Job_Applicant__c> jobApplicants = new List<SCSCHAMPS__Job_Applicant__c>();
            System.debug('###########################################Contact List :'+ selectedTalents);
            System.debug('*********test1 :'+counterMap);
            for(Contact ca : selectedTalents)
            {
                if(ca.id!=null){
                    cand.add(ca);
                    SCSCHAMPS__Job_Applicant__c ja = new SCSCHAMPS__Job_Applicant__c();
                    ja.SCSCHAMPS__Contact_Talent__c = ca.id;
                    for(Id id: counterMap.keySet()){
                        if(id==ca.Id ){         
                           ja.SCSCHAMPS__Rating__c=counterMap.get(id);
                        }   
                    }
                    ja.SCSCHAMPS__Account__c = jobRec.SCSCHAMPS__Account__c;
                    ja.SCSCHAMPS__Account_Manager__c = jobRec.SCSCHAMPS__Account_Manager__c;
                    ja.SCSCHAMPS__Job_Recruiter__c = UserInfo.getUserId();
                    ja.SCSCHAMPS__Hiring_Manager__c = jobRec.SCSCHAMPS__Hiring_Manager__c;
                    ja.SCSCHAMPS__Job__c = jobId;
                    //ja.SCSCHAMPS__Search_Criteria_Long__c = 'Keywords = ' + searchTalent + '; Additional Criteria = ';
                    //ja.SCSCHAMPS__Search_By__c = UserInfo.getUserId();
                    jobApplicants.add(ja);
                    
                }
            }
            System.debug('TalentSearchforJob Before : '+jobApplicants);
            insert jobApplicants;
            System.debug('TalentSearchforJob After : '+jobApplicants);

            PageReference curPage = ApexPages.currentPage();
            curPage.getParameters().put('success','true');
            curPage.getParameters().put('id',Apexpages.currentPage().getParameters().get('id'));
            curPage.setRedirect(true);
            return curPage;

        }
        catch(Exception e)
        {
            ApexPages.addMessages(e);
        }