New Year Sale 2026! 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 2 Question 8 Discussion

Actual exam question for Adobe's AD0-E137 exam
Question #: 8
Topic #: 2
[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
Harris
1 day ago
Wait, why would we need to change to SlingContext?
upvoted 0 times
...
Pedro
6 days ago
Totally agree with A! SlingContext is better for this.
upvoted 0 times
...
Gladis
12 days ago
I think option A is the way to go.
upvoted 0 times
...
Lavonda
17 days ago
Wait, is Flarp a new dance move or a Sling Model? I'm so confused!
upvoted 0 times
...
Annette
22 days ago
A) Replace AemContext with SlingContext with ResourceResolverType of JCR_OAK.
upvoted 0 times
...
Lorita
27 days ago
C) Add a ctx.load().json() method call to get the node data.
upvoted 0 times
...
Tom
1 month ago
B) Add an @Rule annotation before the line private final AemContext ctx = new AemContext();
upvoted 0 times
...
Eura
1 month ago
I'm a bit confused about the differences between AemContext and SlingContext. I hope we don't have to change it, but I guess it could be necessary.
upvoted 0 times
...
Claudia
1 month ago
I practiced a similar question where we had to load JSON data into the context. I feel like option C could be the right choice here.
upvoted 0 times
...
Judy
2 months ago
I think we might need to add that @Rule annotation, but I can't recall the exact purpose it serves in the context of the test.
upvoted 0 times
...
Ceola
2 months ago
This seems straightforward enough. I'd go with option B and add the @Rule annotation. That should set up the AemContext properly for the unit test.
upvoted 0 times
...
Rosalind
2 months ago
I'm a little confused about the difference between AemContext and SlingContext. I'll need to review my notes on Sling testing to make sure I understand which one is more appropriate for this scenario.
upvoted 0 times
...
Queen
2 months ago
Okay, I think the key here is that the unit test needs to load the node data before it can test the getName method. So I'd go with option C and add the ctx.load().json() call.
upvoted 0 times
...
Lettie
2 months ago
I think option A is the best choice. SlingContext is more suitable.
upvoted 0 times
...
Suzi
2 months ago
I remember something about using AemContext for testing Sling Models, but I'm not sure if we need to switch to SlingContext for this one.
upvoted 0 times
...
Dante
3 months ago
Hmm, I wonder if the Flarp Sling Model can do the Floss dance?
upvoted 0 times
...
Nakisha
3 months ago
I’m not sure about B, does @Rule really help here?
upvoted 0 times
...
Jovita
3 months ago
Hmm, this looks tricky. I'm not sure if I should replace the AemContext with SlingContext or just add the @Rule annotation. I'll need to do some more research on the different context types and how they're used in unit testing.
upvoted 0 times
...
Bong
3 months ago
I think I'd start by looking at the code for the Flarp Sling Model and understanding what it's doing. Then I'd try to figure out what the unit test needs to do to properly test the getName method.
upvoted 0 times
...

Save Cancel