I have the following test class:
@isTest(SeeAllData=false)
private with sharing class classNameTest {
@isTest
static testMethod void methodName(){
// declare a constant
private static final String PROFILE_NAME = 'System Administrator';
try{
// use a constant in SOQL
Profile p = [SELECT Id FROM Profile WHERE Name=PROFILE_NAME limit 1];
}
// remaining code
}
when I try to save the file, it gives me an error:
unexpected token 'PROFILE_NAME'.
How can I use the constant in an SOQL query?