AD0-E134 practice question 4 of 15
A developer is on an AEM application that is being used to calculate an employee's salary. The calculation is done in an OSGi service called CalculationService. This service class has a dependency on one other service, called the EmployeeService. How should the developer make sure that the critical code in the CalculationService has a high unit test coverage?
Full set: 72 questionsCorrect Answer:
C. Use a mock framework in the unit test to inject the EmployeeService
Explanation
A mock framework is a tool that allows creating mock objects that simulate the behavior of real objects in a controlled way. A mock framework can be used in a unit test to inject the EmployeeService dependency into the CalculationService and verify its interactions. This way, the unit test can focus on testing the logic of the CalculationService without relying on the actual implementation of the EmployeeService. Reference: https://sling.apache.org/documentation/development/sling-testing-tools.html https://wcm.io/testing/aem-mock/usage.html
Keep practicing
Take the free AD0-E134 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other AD0-E134 practice questions
- Question 1A developer needs to create a workflow custom process step in AEM. In a custom process st…
- Question 2An AEM environment is cloned, and the domain and IPs ate changed. What must be reconfigur…
- Question 3A development team is starting a new AEM project that is going to integrate with the Adob…
- Question 5A developer is working on a project based on core components. The client requests that te…
- Question 6Which practice should be used to push a code fix to make it into the current release cand…
- Question 7A customer adds third-party client libraries to add some features in an existing AEM appl…
