フリー問題

Salesforce Certified Platform Developer II のフリー問題 16 / 20 問目

問題文

A harbor pilot service's Visualforce controller starts a long-running request to a berth scheduling service and continues in a callback. The developer must cover the callback in an Apex test without any traffic leaving the org. What does the test have to do?

選択肢

  1. Call the callback method directly with a hand-built response, because the framework cannot be driven from a test and only the callback's own logic can be covered that way.
  2. Set a mock response against the request's label, then invoke the continuation method so that the callback runs and its own return value can be examined.
  3. Register a callout mock before the action method runs, because a continuation is just a callout with a different syntax, and the callback receives the mocked body as soon as the request resolves itself.
  4. Wrap the action method in the test boundary methods and then query the asynchronous job table to confirm that the request completed, because a continuation is queued like any other asynchronous work and resumes once the boundary closes.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。