I'm trying to mock out something similar to the following structure:
- Task.LastModifiedBy.Username;
- Task.LookupRelationshipToUser__r.Username;
Using the makeRelationships method for this doesn't make sense to me so far. I've used the makeRelationships method to mock out parent to child relationships successfully for mocking out queries but I'm at a loss with on how to proceed with this method.
Using the setReadonlyFields allows me to set Task.LastModifiedById to a mocked Users Id, but then when my code attempts to reference Task.LastModifiedBy.UserName I get null pointer errors while running test. I've tried using this method to set Task.LastModifiedBy.Username but I get error saying it doesn't recognize LastModifiedBy while deploying.
Maybe my terminology is off so searching around and looking at the FFLIB/Apexmocks resources hasn't been helpful so far. If anyone has any advice or can point me in the direction of some examples or documentation I would appreciate it.