Hi I am trying to pass this id through page reference to my controller for the test coerage. but this line below gives me an error saying
unexpected token: '.'
Test Class
@IsTest
public class TestNotice_Controller {
private static ApexPages.StandardController cont;
Opportunity opp = new opportunity(name = 'Cart');
string id = opp.id;
PageReference pg = Page.Notice;
pg.getParameters().put('id', id);
private static testMethod void testNew() {
Test.startTest();
{
// Initialize the controller
Notice_Controller ln = new Notice_Controller(cont);
}
Test.stopTest();
}
}
I don't understand where is the probelem. According to developer guide I am not doing anything wrong. But I don't understand why I am getting this error.