nerdexam
Salesforce

PDI · Question #235

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…

The correct answer is D. The deployment fails because the Apex trigger has no code coverage. Despite achieving 81% overall code coverage, the deployment will fail because the Apex trigger itself has no dedicated code coverage from the provided test methods.

Submitted by neha2k· Apr 18, 2026Testing, Debugging, and Deployment

Question

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?

Options

  • AThe deployment passes because both classes and the trigger were included in the deployment.
  • BThe deployment fails because no assertions were made in the test method.
  • CThe deployment passes because the Apex code has the required >75% code coverage.
  • DThe deployment fails because the Apex trigger has no code coverage.

How the community answered

(54 responses)
  • A
    6% (3)
  • B
    15% (8)
  • C
    4% (2)
  • D
    76% (41)

Why each option

Despite achieving 81% overall code coverage, the deployment will fail because the Apex trigger itself has no dedicated code coverage from the provided test methods.

AThe deployment passes because both classes and the trigger were included in the deployment.

The deployment will fail, not pass, because the trigger lacks the required individual code coverage.

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

While assertions are good practice, the primary reason for failure in this scenario is the absence of code coverage for the trigger, not merely the lack of assertions.

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

Although the overall code coverage exceeds 75%, Salesforce also enforces a rule that each individual Apex trigger must have at least 1% code coverage.

DThe deployment fails because the Apex trigger has no code coverage.Correct

Salesforce requires that every Apex trigger must have at least 1% code coverage from test methods that cause the trigger to execute to be deployed to production environments. The test method directly calls a utility method but does not perform DML operations that would invoke the trigger itself.

Concept tested: Apex trigger code coverage requirements for deployment

Source: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_code_unit_tests_system_requirements.htm

Topics

#Apex Trigger#Code Coverage#Deployment#Apex Testing

Community Discussion

No community discussion yet for this question.

Full PDI Practice