Test.setCreatedDate is used when you want to set CreatedDate for a test-context sObject. This method takes two parameters—an sObject ID and a Datetime value—neither of which can be null.
Test.setCreatedDate is used when you want to set CreatedDate for a test-context sObject. This method takes two parameters—an sObject ID and a Datetime value—neither of which can be null.