Salesforce-Platform-Developer Practice Test

Salesforce Spring 25 Release
237 Questions

A developer created this Apex trigger that calls Myclass.myStaticMethod:


The developer creates a test class with a test method that calls MyClass.myStaticMethod directly, 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 passes because both classes and the trigger were included in the deployment.

B. The deployment fails because no assertions were made in the test method.

C. The deployment passes because the Apex code has the required >75% code coverage.

D. The deployment fails because the Apex trigger has no code coverage.

D.   The deployment fails because the Apex trigger has no code coverage.

Explanation:

Salesforce requires that each Apex trigger is covered by at least 1% code coverage to deploy to production. In your case:

The test method directly calls MyClass.myStaticMethod, which covers the method in the class.
However, the trigger itself is not executed by the test, so the trigger has 0% coverage.
Even though the total coverage is over 75%, individual triggers must have at least some coverage (≥1%).

Salesforce-Platform-Developer Practice-Test - Home Previous
Page 19 out of 237 Pages