function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
impalacrazy69impalacrazy69 

Test class help

So below is the trigger created and then the test class. The error i am geting is: Method does not exist or incorrect signature:[createobjectcreator].CreateCase(SOBJECT:Account) and im not sure what this means. Does it not like me creating a case?

Trigger:

trigger Case_UpdateSiteInfo on Case (before update) {

Set<Id> siteIds = new Set<Id>();

// List<Site__c> results = new List<Site__c>();

    for (Case c : trigger.new) {
        siteIds.add(c.Site__c);
    }
   
//   
   
    if (siteIDs.size() > 0) {
       
        // Get all the cases and site fields we will need
       Map<Id, Site__c> siteFieldMap = new Map<Id, Site__c>(
        [SELECT Id, Status__c, Region_New__c, User__c
           FROM Site__c
             WHERE Id in :siteIds]
    );
       
        // Loop through cases and assign values                   
           for (Case c : trigger.new) {
        c.Site_Status__c    = siteFieldMap.get(c.Site__c).Status__c;
        c.Region__c         = siteFieldMap.get(c.Site__c).Region_New__c ;
        c.SE__c    = siteFieldMap.get(c.Site__c).User__c;
       
        // Run the update
//      if (siteIDs.size() > 0) update siteIds;
    }
   

       
    }
}

Test Class:

@isTest
private class Test_Case_UpdateSiteInfo {

    static testMethod void myUnitTest() {
    
      // TO DO: implement unit test
     
      // Create Account, contact, opportunity and Site using standard test objects
     createObjectCreator oc = new createObjectCreator();
    
     Account a = oc.CreateAccount();
     Case c = oc.CreateCase(a);
     Site__c s = oc.CreateSite(a);
   
    
     // Populate the Case Info
     c.ContactId = '003D000000stP8e';
     c.SE__c = '005c0000000pmUb';
     c.AccountId = a.Id;
     c.Site__c = s.Id;
     c.Version__c = 'Not Available';
     c.Severity__c = 'Low';
     c.Origin = 'Web';
     c.Subject = 'Testing 123';
        insert c;
    
    
     // Update the Site address
     c.Site__c = 'a012000000SWGT1';
     update c;
         
  
    
     // Run asserts to check that all fields updated
     Case assert = [SELECT Id, Status__c, Region_New__c, User__c FROM Site__c WHERE Id = :c.Id];
     System.assertEquals(c.Site_Status__c, assert.Status__c);
     System.assertEquals(c.Region__c, assert.Region_New__c);
     System.assertEquals(c.SE__c, assert.User__c);
         
    }
}
Satish_SFDCSatish_SFDC
It seems there is a class createObjectCreator.
Pleae check if this class has a method called CreateCase() which accepts an Account object as its argument.
In case there is such a method, make sure that it is not static.

Hope this helps.

Regards,
Satish Kumar