I have an issue with Querying a record in a unit test with a custom set createdDate using the method Test.setCreatedDate();
static testMethod void test()
{
Account a = new Account(name='myAccount');
insert a;
Test.setCreatedDate(a.Id, DateTime.newInstanceGmt(2022,12,12));
Test.startTest();
// Success
System.assertEquals(1, [SELECT Count() FROM Account WHERE CreatedDate >= 2011-01-01T00:00:00Z]);
// Fails
System.assertEquals(1, [SELECT Count() FROM Account WHERE CreatedDate >= 2022-01-01T00:00:00Z]);
Test.stopTest();
}