Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe Exam AD0-E134 Topic 6 Question 16 Discussion

Actual exam question for Adobe's AD0-E134 exam
Question #: 16
Topic #: 6
[All AD0-E134 Questions]

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?

Show Suggested Answer Hide Answer

Contribute your Thoughts:

Jolanda
3 days ago
Option A? Really? Mocking the CalculationService itself? That's like trying to test a calculator by mocking the calculator. *chuckles* I think we all know what the right answer is here.
upvoted 0 times
...
Blossom
6 days ago
Option D? Seriously? Disabling the calls to the EmployeeService? That's like trying to fix a leaky faucet by turning off the water supply. Not a good solution.
upvoted 0 times
...
Scarlet
12 days ago
Option B might work, but it's not the most efficient. Instantiating the EmployeeService in the test and passing it to the CalculationService constructor seems like a lot of extra work.
upvoted 0 times
...
Nikita
14 days ago
I agree with Alesia. Mocking the EmployeeService is the best approach to ensure high unit test coverage for the critical code in the CalculationService.
upvoted 0 times
Truman
4 days ago
B) Instantiate the EmployeeService in the unit test and pass it to the constructor of the CalculationService
upvoted 0 times
...
Valda
6 days ago
A) Use a mock framework in the unit test to inject the CalculationService
upvoted 0 times
...
...
Fidelia
25 days ago
But using a mock framework allows for better isolation of the code being tested, making it easier to control the behavior of the EmployeeService.
upvoted 0 times
...
Roxanne
27 days ago
I disagree, I believe instantiating the EmployeeService in the unit test and passing it to the constructor of the CalculationService is more reliable.
upvoted 0 times
...
Alesia
28 days ago
Option C is the way to go. Mocking the EmployeeService will help us isolate the CalculationService and focus on testing its core logic without any external dependencies.
upvoted 0 times
...
Fidelia
29 days ago
I think using a mock framework to inject the CalculationService is the best option.
upvoted 0 times
...
Timothy
30 days ago
But using a mock framework allows for better isolation and control over the test environment.
upvoted 0 times
...
Nathalie
1 months ago
I disagree, I believe instantiating the EmployeeService in the unit test is more reliable.
upvoted 0 times
...
Timothy
1 months ago
I think using a mock framework to inject the CalculationService is the best option.
upvoted 0 times
...

Save Cancel