You need to sign in to do that
Don't have an account?

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.
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.
All Answers