フリー問題

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

問題文

A cheese maker's ripening calculator asks a helper class for today's date, and a reviewer objects to the line that checks whether a test is currently running and returns a fixed date when it is. Which change follows the documented approach?

選択肢

  1. Keep the branch but move it into the helper class, because the calculator then has no knowledge of the test and only the helper needs to be reviewed, so the reviewer looks at one file.
  2. Annotate the helper's method so it is visible to tests and assign the fixed date to it from the test class, because a member marked as visible to tests can be written from outside its own class without changing the production signature.
  3. Have the calculator receive the helper as a parameter so the test can pass a stub built at runtime, which is what the platform's stubbing feature is designed for.
  4. Make the helper's method static so that the test can override it, because static members are resolved at compile time in either build.

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

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