Study for the Salesforce Platform Developer Exam. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Practice this question and more.


Which features are available when writing apex test classes? (Choose 2)

  1. The ability to select error types to ignore in the developer console.

  2. The ability to write assertions to test after a @future method.

  3. The ability to set and modify the CreatedDate field in apex tests.

  4. The ability to select testing data using csv files stored in the system.

The correct answer is: The ability to set and modify the CreatedDate field in apex tests.

When it comes to writing Apex test classes, one of the notable features is the ability to set and modify the CreatedDate field in apex tests. This functionality is crucial for testing various scenarios related to record creation and time-based logic. Test classes run in a special test context that isolates them from the organization’s actual records but allows explicit control over certain field values, including CreatedDate. This functionality allows developers to simulate different states of records easily and test triggers, workflows, or process builders that rely on the creation date of a record to see how their functionality behaves under different conditions. Additionally, the option related to writing assertions to test after a @future method is a practical feature, as it allows developers to effectively verify that the expected outcomes occur after asynchronous operations are executed. Since @future methods are executed in a separate thread, tests must be organized effectively to ensure verification of their result through assertions. The other options do not present features that are typically accessible or practical in standard Apex testing scenarios. While error handling and data configuration are essential in various contexts, the specific capabilities listed in the correct options support direct testing needs that are intrinsic to effective Apex development and testing.