I'm writing a test for a Contact trigger that references a class. I get the error: "Invalid id value for this SObject type". Not exactly sure how to reference this.
Thanks for any help.
Kevin
When a Contact record is Inserted, Updated or Deleted, a trigger fires and updates a field in the Account record. The full error:
Class: TestDardenCountAlumni
Method Name: updateAccount
Pass/Fail: Fail
Error Message :System.TypeException: Invalid id value for this SObject type: 000000000000001AAA
Stack Trace: Class.TestDardenCountAlumni.updateAccount: line 6, column 1
Here is my test:
@isTest
public class TestDardenCountAlumni {
static testMethod void updateAccount(){
Account accountToInsert = new Account();
accountToInsert.Id = '000000000000001AAA';
accountToInsert.Name = 'Test Account';
accountToInsert.Number_of_Alumni__c = 0;
insert accountToInsert;
Contact contactToInsert = new Contact();
contactToInsert.FirstName = 'Test Contact';
contactToInsert.Darden_Degree__c = 'MBA';
contactToInsert.Darden_Preferred_Year__c = '2014';
contactToInsert.AccountId = '000000000000001AAA';
insert contactToInsert;
}
}