I have rewritten a class whose testing was originally within the class and not a separate test class.
As it is right now, my test code looks like this :
@isTest
private class TestCSHOrgModelQuarterly {
static Id getRecordTypeId(String sObjectType, String Name) {
return [select id from recordtype where sobjecttype=:sObjectType and name=:Name limit 1].id;
}
static final Id Org_Rectype = getRecordTypeId('Organization_Model__c','Global');
static final Id A_MM_Rectype = getRecordTypeId('Account','Multi');
Account Acc1;
Organization_Model__c Org1;
String u; // Unique number for this test run.
TestCSHOrgModelQuarterly() {
// Create a unique string for this test so we're never confused with existing data.
u = Datetime.now().millisecond().format();
Acc1 = new Account(Name=u+'Test1', recordtypeid=A_MM_Rectype, status_corporate_travel__c = 'Client', ownerid=UserInfo.getUserId(), billingcountry='USA');
insert Acc1;
Org1 = new Organization_Model__c(Name=u+'Test2', recordtypeid=Org_Rectype, Org_Model_CSH_to_be_completed_by__c = UserInfo.getUserId(), Account__c = Acc1.id, Org_Model_CSH__c = 'Quarterly');
insert Org1;
}
static testMethod void testReview() {
// Reduce the number of message we get during debugging.
system.debug(Logginglevel.DEBUG);
// All we're really doing is setting up the data, calling the routine, and checking the results.
TestCSHOrgModelQuarterly x = new TestCSHOrgModelQuarterly();
Date tod = Date.Today();
// Calculate the dates we might use for AM_Completion depending on record type.
Date AM_Date_10 = Date.newInstance(tod.addMonths(1).year(),tod.addMonths(1).month(),10);
Date AM_Date_15 = Date.newInstance(tod.addMonths(1).year(),tod.addMonths(1).month(),15);
test.startTest();
CSHOrgModelQuarterly CSHR = new CSHOrgModelQuarterly();
String xxx = CSHR.doReview(true);
test.stopTest();
CSH_New__c Org1Csh = [select id, Due_Date__c from CSH_New__c where Organization_Model__c = x.Org1.id ];
system.assertEquals(AM_Date_10, Org1Csh.Due_Date__c);
}
}
I am getting this error when attempting to save it :
unexpected token: 'x.Org1.id'
Thank you very much for any advice you can give.