@@ -4419,15 +4419,15 @@ private class SOQL_Test {
44194419 static void mockedToIdMapByRelationshipField () {
44204420 // Setup
44214421 SOQL .mock (' mockingQuery' ).thenReturn (new List <Account >{
4422- new Account (Name = ' Account 1' , Parent = new Account (Name = ' Parent 1' , CreatedById = SOQL .IdGenerator .get (User .SObjectType ))),
4423- new Account (Name = ' Account 2' , Parent = new Account (Name = ' Parent 2' , CreatedById = SOQL .IdGenerator .get (User .SObjectType )))
4422+ new Account (Name = ' Account 1' , Parent = new Account (Name = ' Parent 1' , Id = SOQL .IdGenerator .get (Account .SObjectType ))),
4423+ new Account (Name = ' Account 2' , Parent = new Account (Name = ' Parent 2' , Id = SOQL .IdGenerator .get (Account .SObjectType )))
44244424 });
44254425
44264426 // Test
4427- Map <Id , Account > result = (Map <Id , Account >) SOQL .of (Account .SObjectType ).mockId (' mockingQuery' ).toIdMapBy (' Parent' , Account .CreatedById );
4427+ Map <Id , Account > result = (Map <Id , Account >) SOQL .of (Account .SObjectType ).mockId (' mockingQuery' ).toIdMapBy (' Parent' , Account .Id );
44284428
44294429 // Verify
4430- Assert .areEqual (2 , result .size (), ' Size of the result map should be equal to 2, because the accounts have 2 parents.' );
4430+ Assert .areEqual (2 , result .size (), ' Size of the result map should be equal to 2, because the accounts have 2 different parents.' );
44314431 }
44324432
44334433 @IsTest
@@ -4474,18 +4474,18 @@ private class SOQL_Test {
44744474 @IsTest
44754475 static void mockedtoAggregatedIdMapByRelationshipField () {
44764476 // Setup
4477- Id userId = SOQL .IdGenerator .get (User .SObjectType );
4477+ Id parentId = SOQL .IdGenerator .get (Account .SObjectType );
44784478
44794479 SOQL .mock (' mockingQuery' ).thenReturn (new List <Account >{
4480- new Account (Name = ' Account 1' , Parent = new Account (Name = ' Parent 1' , CreatedById = userId )),
4481- new Account (Name = ' Account 2' , Parent = new Account (Name = ' Parent 2' , CreatedById = userId ))
4480+ new Account (Name = ' Account 1' , Parent = new Account (Name = ' Parent 1' , Id = parentId )),
4481+ new Account (Name = ' Account 2' , Parent = new Account (Name = ' Parent 2' , Id = parentId ))
44824482 });
44834483
44844484 // Test
4485- Map <Id , List <Account >> result = (Map <Id , List <Account >>) SOQL .of (Account .SObjectType ).mockId (' mockingQuery' ).toAggregatedIdMapBy (' Parent' , Account .CreatedById );
4485+ Map <Id , List <Account >> result = (Map <Id , List <Account >>) SOQL .of (Account .SObjectType ).mockId (' mockingQuery' ).toAggregatedIdMapBy (' Parent' , Account .Id );
44864486
44874487 // Verify
4488- Assert .areEqual (1 , result .size (), ' Size of the result map should be equal to 1, because all parent accounts have the same created by user .' );
4488+ Assert .areEqual (1 , result .size (), ' Size of the result map should be equal to 1, because all parent accounts have the same parent .' );
44894489 }
44904490
44914491 @IsTest
0 commit comments