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
Gary PayneGary Payne 

Apex Class has unexpected token: '\upsert' error

My Apex Class "RequestController" is showing a problem in the Developer Console: "Line 1164 - Unexpected token: '\upsert'. I am new to working with Apex and am not a coder.  How do I go about resolving this problem in the Developer console?  Following is a partial  piece of the RequestController around line 1164 (upsert rCon.request;):
    static testMethod void RequestRFP_Test19() {
    
        PageReference pageRef = Page.requesttype;
        test.setCurrentPageReference (pageRef);
        
        RequestController rCon = new RequestController ();
        
        Account a19 = new Account (Name = 'test');
        
        insert a19;
        
        Opportunity o19 = new Opportunity (
                              AccountID = a19.id
                            , Name = 'test opp'
                            , StageName ='00 - Prospect'
                            , CloseDate = system.today()
                            , Taken_From__c = 'Allied Solutions'
                            );
        
        insert o19;
        
        rCon.request.Opportunity__c = o19.id;
        rCon.Request.RFC_Request__c = true;
        rCon.request.Product__c = 'MTG Protection Insurance and Tracking'
        
        upsert rCon.request;
        
        test.startTest();
        rCon.save();
        rCon.cancel();
        rCon.step1();
        rCon.step2();
        rCon.step3();
  
        test.stopTest();
    
}

Note there are a total of 21 tests in this Apex Class.  They all have a similar structure to one listed above, with the same line as line 1164. 
Best Answer chosen by Gary Payne
VinojVinoj
It looks like you are missing a semi-colon on the previous line:
rCon.request.Product__c = 'MTG Protection Insurance and Tracking';

upsert rCon.request;

 

All Answers

VinojVinoj
It looks like you are missing a semi-colon on the previous line:
rCon.request.Product__c = 'MTG Protection Insurance and Tracking';

upsert rCon.request;

 
This was selected as the best answer
Gary PayneGary Payne
Thanks Vinoj, that corrected the issue!