Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 339 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 339
Topic #: 1
[All Certified Platform Developer II Questions]

A developer created the following test method:



The developer org has five accounts where the name starts with "Test". The developer executes this test in the Developer Console.

After the test code runs, which statement is true?

  • A. The test will fail.
  • B. There will be no accounts where the name starts with "Test".
  • C. There will be five accounts where the name starts with "Test".
  • D. There will be six accounts where the name starts with "Test".
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Ullr
Highly Voted 1 year, 8 months ago
C is correct You can't delete real records even during testing
upvoted 7 times
...
goldy_666
Most Recent 2 months, 2 weeks ago
Selected Answer: B
I tested it. B is correct. The actual accounts will not be deleted but after delete operation in the test class it will return size as 0
upvoted 2 times
goldy_666
2 months, 2 weeks ago
C is correct.
upvoted 1 times
...
...
BaruLaks
7 months, 1 week ago
Selected Answer: B
it will not throw any error. the final assert succeeds.
upvoted 2 times
...
Sapphire808
1 year, 1 month ago
D In the context of the test class, test accounts will hold 6 records containing the word "test." Five of them will come from the seeAllData = true context and one of them will come from the insert. Because it is a test class, any DML is not committed to the database, therefore to actually reference a deletion for assertion, you will have to create a new variable to hold the deletion. Please see the code below for reference. // Delete records delete recordsToDelete; // After the delete operation, you can assert that the records are deleted List<Custom_Object__c> deletedRecords = [SELECT Id FROM Custom_Object__c WHERE Id IN :recordsToDelete]; // Verify that the records are no longer present in the database System.assertEquals(0, deletedRecords.size(), 'Records should be deleted'); }
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...