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
MaggieSumitMaggieSumit 

Getting Error On test Class

  1. public class ControllerFeedback {
  2.     public alu_Opportunity_Matching__c objs {get;set;}
  3.     public void init() {
  4.         Id ids = ApexPages.currentPage().getParameters().get('id');    
  5.         system.debug('Id'+ids);
  6.         alu_Opportunity_Matching__c obj = [select id, Applicant_Student_Record__r.Name, Application_Status__c,Opportunity__r.Name FROM alu_Opportunity_Matching__c WHERE id = :ids];        
  7.         objs = obj;
  8.         system.debug('name'+objs);
  9.         obj.Application_Status__c = 'Opted-out';
  10.         Update obj; 
  11.         return;        
  12.     }
  13.     
 
  1. }
  2. @isTest
  3. public class ControllerFeedbackTests {
  4.     
  5.     static testMethod void test_ControllerFeedback() {
  6.         
  7.     test.startTest();
  8.     
  9.     account acc = new account();
  10.     acc.Name = 'test';
  11.     insert acc;
  12.     
  13.     Contact con = new Contact();
  14.     con.Lastname = 'test con';
  15.     con.Email = 'test@gmail.com';
  16.     con.AccountId = acc.Id;
  17.     insert con;
  18.     
  19.     Opportunity opp = new Opportunity();
  20.     opp.AccountId = acc.Id;
  21.     opp.Name = 'Demo';
  22.     opp.StageName = 'Demo';
  23.     opp.CloseDate = System.Today();
  24.     opp.Key_Contact__c = con.Id;
  25.     insert opp;
  26.  
  27.     alu_Opportunity_Matching__c aluOpp = new alu_Opportunity_Matching__c();
  28.     aluOpp.Applicant_Student_Record__c = opp.Key_Contact__c;
  29.     aluOpp.Opportunity__c = opp.Id;
  30.     aluOpp.Application_Status__c = 'none';
  31.  
  32.     insert aluOpp; 
  33.     
  34.     PageReference testPage = new pagereference('/apex/feedback');
  35.     ApexPages.currentPage().getParameters().put( 'id', aluOpp.id );
  36.     
  37.     ControllerFeedback cf = new ControllerFeedback();
  38.     cf.init(); 
  39.     
  40.     test.stopTest();
  41.     }
  42.     
  43. }
Surya Prakash TomarSurya Prakash Tomar

Hi Sumit,

 

Could you please just post an error message so this will help me to resolved the error.