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

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 177 discussion

Actual exam question from Salesforce's CRT-450
Question #: 177
Topic #: 1
[All CRT-450 Questions]

A developer created this Apex trigger that calls MyClass.myStaticMethod: trigger myTrigger on Contact(before insert)
{ MyClass.myStaticMethod(trigger.new, trigger.oldMap); }
The developer creates a test class with a test method that calls MyClass.myStaticMethod, resulting in 81% overall code coverage.
What happens when the developer tries to deploy the trigger and two classes to production, assuming no other code exists?

  • A. The deployment fails because no assertions were made in the test method.
  • B. The deployment passes because both classes and the trigger were included in the deployment.
  • C. The deployment passes because the Apex code has required (>75%) code coverage.
  • D. The deployment fails because the Apex trigger has no code coverage.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
huwamaru
1 year ago
Selected Answer: D
In this scenario, the test class calls MyClass.myStaticMethod, but the trigger itself is not being tested directly in the test method. The trigger needs its own test method in the test class to ensure it has code coverage. Since the trigger doesn't have any test coverage, the deployment will fail even if the overall code coverage for the classes is above 75%. https://help.salesforce.com/s/articleView?id=000384442&type=1
upvoted 1 times
...
govosen887
1 year, 7 months ago
Selected Answer: D
Triggers need at least one line of coverage regardless of overall coverage % of the code
upvoted 3 times
...
zenchouu
2 years, 5 months ago
Selected Answer: C
why not C ?
upvoted 1 times
zenchouu
2 years, 4 months ago
my bad, i agree the answer is D
upvoted 2 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 ...