QuestionQ48

No official topic/domain breakdown was publicly listed on the Adobe certification page or prep guide page I could access for AD0-E137

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

Question Image

What must be changed for the unit test to successfully test the getName method of the Thud Sling Model?

Explanation

The mock context must contain a resource at /content/foo with the property value that the Sling Model injects for getName(). ctx.load().json() imports the JSON fixture into the mock resource hierarchy; merely setting the current resource path does not create that resource or its data. The Sling Mocks documentation identifies context.load().json(...) as the mechanism for loading test content and supports manually registering Sling Models with addModelsForClasses(...).

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!