How should a developer verify that a specific Account record is being tested in a test
class for a Visualforce controller?
A.
Insert the Account in the test class, instantiate the page reference in the test class, then use System.currentFageReference() .getFarameters() .put{) to set the Account ID.
B.
Insert the Account into Salesforce, instantiate the page reference in the test class, then use system. setFarentRecordId() .get() to set the Account ID.
{of Instantiate the page reference in the test class, insert the Account in
the test class, then use =seeAllData=trus to view the Account.
C.
Instantiate the page reference in the test class, insert the Account in
the test class, then use system.setFarentRecordrd() .get() to set the Account ID,
To test a Visualforce controller that works with specific records, you should insert the necessary test data in the test class. Then instantiate a PageReference for the Visualforce page, set the record id in the page parameters, and use System.currentPageReference().getParameters().put('id', recordId) to simulate navigating to the page with that record.
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