Examers.io
ExamsOrganizationsHow it worksPricingHelp & FAQ
Salesforce logo

SalesforceCertified Platform Developer II

Domain 7Objective 3

Describe the Implications of Testing Visualforce Controllers and Controller Extensions. PLATFORM-DEVELOPER-II Practice Questions (Page 2)

Part of the TESTING domain, which accounts for 7% of the PLATFORM-DEVELOPER-II exam.

27questions here
6free pages
10concepts
7%of the exam

Questions 6–10

  1. 6foundation · easy

    In a test for a Visualforce controller, how do you verify that a method correctly updates a property?

    Select an answer first
  2. 7expert · hard

    A controller method returns a PageReference to a page that requires a parameter 'id'. The method sets the parameter using pageRef.getParameters().put('id', recordId). In a test, the developer asserts that the returned PageReference's URL contains 'id='. The test passes. What additional assertion is needed to fully verify the PageReference?

    Select an answer first
  3. 8application · medium

    A developer is writing a test for a controller method that updates an Account's billing city. The method takes an Account Id and a new city as arguments. What is the best practice for setting up the test data?

    Select an answer first
  4. 9application · medium

    A controller method attempts to insert a list of Contacts and catches any DmlException, adding the error message to the page via ApexPages.addMessage(). A developer writes a test that passes a Contact with a blank LastName to trigger the exception. What assertion should the test make to verify the error handling works?

    Select an answer first
  5. 10application · medium

    A developer is writing tests for a Visualforce controller that has a method to calculate a discount based on the current user's profile. The method uses UserInfo.getProfileId() to determine the discount. What is the best way to test this method for different profiles?

    Select an answer first
Finished these 5 questions?

Review the revealed explanations, or continue through the curriculum.

Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Salesforce. “PLATFORM-DEVELOPER-II” is a trademark of its owner, used for identification only.