The runAs() system method is used in test methods to verify record sharing and access based on user roles, profiles, and sharing rules.
It does not enforce Field-Level Security (FLS) or object permissions, which need to be explicitly tested in the code.
Why Option A is Correct:
runAs() ensures that the sharing rules of the specified user are applied during the test, validating sharing-based access controls.
Why Others Are Incorrect:
Option B: FLS is not enforced by runAs().
Option C: Permissions are not enforced by runAs(); only record-level sharing is validated.
For more information, see Salesforce documentation on runAs(): https://help.salesforce.com/
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit