Salesforce Certified Platform Developer II — Question 116

What is a best practice when unit testing a controller? (Choose two.)

Answer options

Correct answer: B, D

Explanation

The correct answers are B and D because verifying correct references with getURL() ensures that the controller is functioning as intended, while setting query parameters with getParameters().put is essential for simulating different scenarios in tests. Options A and C are not best practices, as simulating user interaction should be avoided in unit tests, and accessing all test data can lead to dependencies on non-isolated test cases.