You need to sign in to do that
Don't have an account?
farah sherif
I need help with a test class can anyone help
@isTest
private class AssetTriggerTest{
@testSetup
static void testclass(){
List<sObject> ls = Test.loadData(Asset.sObjectType, 'AssetTest2');
List<sObject> lsa = Test.loadData(Account.sObjectType, 'AccountTestF');
}
public static testMethod void test(){
Map<id,Asset> a = New Map <id, Asset >([select Product_Family__c , Status from Asset ]);
List<Asset> l = a.values();
for( Asset ast:l){
if(ast.Product_Family__c == '360'){
ast.Status = 'Canceled';
}
}
update l;
Account acc=[select Account_Status__c from Account limit 1];
system.assertEquals(acc.Account_Status__c,'Cancel');
}
}
it's giving me this error :
System.StringException: Error in CSV resource 'AssetTestF' line 2: Cannot set the value of a calculated field
private class AssetTriggerTest{
@testSetup
static void testclass(){
List<sObject> ls = Test.loadData(Asset.sObjectType, 'AssetTest2');
List<sObject> lsa = Test.loadData(Account.sObjectType, 'AccountTestF');
}
public static testMethod void test(){
Map<id,Asset> a = New Map <id, Asset >([select Product_Family__c , Status from Asset ]);
List<Asset> l = a.values();
for( Asset ast:l){
if(ast.Product_Family__c == '360'){
ast.Status = 'Canceled';
}
}
update l;
Account acc=[select Account_Status__c from Account limit 1];
system.assertEquals(acc.Account_Status__c,'Cancel');
}
}
it's giving me this error :
System.StringException: Error in CSV resource 'AssetTestF' line 2: Cannot set the value of a calculated field
Please delete those read-only fields from the csv file and run the test class