Exam AD0-E103 All QuestionsBrowse all questions from this exam
Question 62

A banking AEM application contains functionality to calculate a mortgage rate based on user input. A servlet in place calculates the result in the backend. A call to an internal third-party REST service is required to retrieve the average object value based on a given zip code.

The following three service interfaces are used:

MortgageCalculationServlet, MortgageCalculationService and ObjectValueLookupRestService where MortgageCalculationServlet has a dependency to MortgageCalculationService and MortgageCalculationService has a dependency to ObjectValueLookupRestService.

The calculation has many combinations of input parameters and edge cases, so the JUnit coverage must be as high as possible.

Which two strategies should the developer use to ensure testability of the application code? (Choose two.)

    Correct Answer: C, D

    To ensure high testability of the application code, the developer should use a mock framework to create and inject mocks in the test code, as this allows for extensive testing of various combinations and edge cases without relying on actual service implementations. Additionally, using the standard OSGi @Reference annotation to wire dependencies in application code is essential as it promotes better modularity and testability, allowing services to be easily substituted with mock implementations during unit testing.

Discussion
griosOptions: AC

A and C

chunpinOptions: AC

A and C https://sling.apache.org/documentation/development/osgi-mock.html