PDII practice question 9 of 10
A developer is trying to access org data from within a test class. Which sObject type requires the test class to have the (seeAllData=true) annotation?
Full set: 198 questionsBy default, Apex test classes are isolated from organizational data to ensure tests are independent and repeatable. However, some setup and metadata objects function as exceptions and are always accessible without the @isTest(SeeAllData=true) annotation. User, Profile, and RecordType belong to this category of setup objects. The Report sObject, however, is not classified as a globally accessible setup object. Furthermore, because Report records cannot be created using standard Apex Data Manipulation Language (DML) statements, the only way a test class can query and access existing Report records from the organization is by explicitly annotating the test class or test method with @isTest(SeeAllData=true).
A. User: Incorrect because User is a setup object that is automatically visible to test classes without special annotations.
B. RecordType: Incorrect because RecordType is universally accessible in test contexts without requiring the SeeAllData annotation.
D. Profile: Incorrect because Profile is a setup object and is persistently available to unit tests without requiring the SeeAllData annotation.
Salesforce Apex Developer Guide, "Isolation of Test Data from Organization Data in Unit Tests" (Section: Objects That Are Not Isolated).
Salesforce Apex Developer Guide, "Using the isTest(SeeAllData=True) Annotation".
Keep practicing
Take the free PDII practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PDII practice questions
- Question 3Which three Visualforce components can be used to initiate Ajax behavior to perform parti…
- Question 4A user receives the generic "An internal server error has occurred” while interacting wit…
- Question 5A developer is asked to develop a new AppFxchange application. A feature of the program c…
- Question 7Universal Containers implements a private sharing model for the Convention Attendee co cu…
- Question 8Universal Containers develops a Visualforce page that requires the inclusion of external …
- Question 10A company has a Lightning page with many Lightning Components, some that cache reference …
