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 AD0-E137 Exam - Topic 4 Question 18 Discussion

A developer has created a new Sling Model called Flarp. The developer wants to create a unit test for this Sling Model.What needs to be changed for the unit test to successfully test the getName method of the Flarp Sling Model?
A) Replace AemContext with SlingContext with ResourceResolverType of JCR_OAK.
B) Add an @Rule annotation before the line private final AemContext ctx = new AemContext();
C) Add a ctx.load().json() method call to get the node data.

Adobe AD0-E137 Exam - Topic 4 Question 18 Discussion

Actual exam question for Adobe's AD0-E137 exam
Question #: 18
Topic #: 4
[All AD0-E137 Questions]

A developer has created a new Sling Model called Flarp. The developer wants to create a unit test for this Sling Model.

What needs to be changed for the unit test to successfully test the getName method of the Flarp Sling Model?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Shaquana
2 hours ago
I think option A is the best. SlingContext is more suitable.
upvoted 0 times
...
Franchesca
5 days ago
Agreed, let's keep it simple with C.
upvoted 0 times
...
Helaine
10 days ago
C is straightforward, just load the data and test.
upvoted 0 times
...
Ilene
16 days ago
Right, we need to ensure the model has the right data to test.
upvoted 0 times
...
Taryn
21 days ago
Exactly, without the node data, the test won't work.
upvoted 0 times
...
Franchesca
26 days ago
B seems unnecessary, we need the context loaded.
upvoted 0 times
...
Helaine
1 month ago
I feel like A is too drastic of a change.
upvoted 0 times
...
Ilene
1 month ago
Yeah, adding ctx.load().json() makes sense.
upvoted 0 times
...
Taryn
1 month ago
I think option C is the best choice.
upvoted 0 times
...
Jamal
2 months ago
Not sure if changing to SlingContext is the best move.
upvoted 0 times
...
Maurine
2 months ago
Surprised that @Rule annotation isn't the first choice here!
upvoted 0 times
...
Francine
2 months ago
Wait, why would you replace AemContext? That seems off.
upvoted 0 times
...
Isidra
2 months ago
I agree, without that, the test won't work properly.
upvoted 0 times
...
Arlette
2 months ago
I think option C is definitely needed to load the node data.
upvoted 0 times
...
Edna
2 months ago
I definitely remember that we need to load some data for the test, so option C seems like the right choice to me.
upvoted 0 times
...
Jacqueline
3 months ago
I feel like replacing AemContext with SlingContext could be a valid option, but I can't recall the specifics of when to do that.
upvoted 0 times
...
Kristin
3 months ago
I'm not entirely sure, but I remember something about using @Rule annotations in unit tests. Maybe that's relevant here?
upvoted 0 times
...
Stefan
3 months ago
I think we might need to add a ctx.load().json() method call to set up the test data properly. That sounds familiar from our practice questions.
upvoted 0 times
...

Save Cancel