I create a test method and I do not understand why the result is a failure.
1, we have a TestProfile Custom profile with create permission on Account object.
2, The next snippet of code run with failure:
@isTest
public class testTestProfile {
@isTest
public static void testAccountCreatablePermission(){
Profile p = [SELECT Id FROM Profile WHERE Name='TestProfile'];
system.debug(p);
User u = new User(Alias = 'standt', Email='[email protected]',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='[email protected]');
System.runAs(u){
Schema.DescribeSObjectResult dsr = Schema.SObjectType.Account;
System.assert(dsr.isCreateable());
}
}
}
Can anybody explain why the test case is fail?