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
2 months 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
Taryn
19 days ago
C) Use a mock framework in the unit test to inject the EmployeeService
upvoted 0 times
...
Shenika
25 days ago
B) Instantiate the EmployeeService in the unit test and pass it to the constructor of the CalculationService
upvoted 0 times
...
Jaclyn
30 days ago
A) Use a mock framework in the unit test to inject the CalculationService
upvoted 0 times
...
...
Blossom
2 months 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
Katlyn
18 days ago
C) Use a mock framework in the unit test to inject the EmployeeService
upvoted 0 times
...
Salome
18 days ago
B) Instantiate the EmployeeService in the unit test and pass it to the constructor of the CalculationService
upvoted 0 times
...
Roxanne
24 days ago
A) Use a mock framework in the unit test to inject the CalculationService
upvoted 0 times
...
...
Scarlet
2 months 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
2 months 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
Berry
2 months ago
C) Use a mock framework in the unit test to inject the EmployeeService
upvoted 0 times
...
Truman
2 months ago
B) Instantiate the EmployeeService in the unit test and pass it to the constructor of the CalculationService
upvoted 0 times
...
Valda
2 months ago
A) Use a mock framework in the unit test to inject the CalculationService
upvoted 0 times
...
...
Fidelia
3 months 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
3 months 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
3 months 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
Lai
1 months ago
Using a mock framework in the unit test for the EmployeeService is definitely the way to go for high unit test coverage.
upvoted 0 times
...
Delmy
1 months ago
Mocking the EmployeeService will allow us to control its behavior and focus on testing the CalculationService's logic.
upvoted 0 times
...
Fausto
1 months ago
Agreed, using a mock framework to inject the EmployeeService in the unit test will make it easier to test the critical code.
upvoted 0 times
...
Fatima
1 months ago
I think option C is the best choice. Mocking the EmployeeService will help us isolate the CalculationService for testing.
upvoted 0 times
...
...
Fidelia
3 months ago
I think using a mock framework to inject the CalculationService is the best option.
upvoted 0 times
...
Timothy
3 months ago
But using a mock framework allows for better isolation and control over the test environment.
upvoted 0 times
...
Nathalie
3 months ago
I disagree, I believe instantiating the EmployeeService in the unit test is more reliable.
upvoted 0 times
...
Timothy
3 months ago
I think using a mock framework to inject the CalculationService is the best option.
upvoted 0 times
...

Save Cancel