How to mock com.adobe.acs.commons.models.injectors.impl.SharedValueMapValueInjector | Community
Skip to main content
Level 6
April 7, 2023
Solved

How to mock com.adobe.acs.commons.models.injectors.impl.SharedValueMapValueInjector

  • April 7, 2023
  • 2 replies
  • 932 views

I have a sling model

@@SharedValueMapValu(type = SharedComponentProperties.ValueTypes.GLOBAL)
protected String fantasticBtnLabel;

and I have a unit test JUNIT5

context.registerInjectActivateService(new SharedValueMapValueInjector());

When @SharedValueMapValue is called from the Sling Model unit tests, it works... but when I am trying to get the property of "fantasticBtnLabel", I am getting null. how can I solve this?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Please raise this over at the ACS AEM Commons project; as the feature is coming from there, they should provide the solution to this 🙂

2 replies

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 8, 2023

If @SharedValueMapValue is not supported via mocking, you can at lease provide it with @1497330(stringValues={"something"});

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
April 9, 2023

Please raise this over at the ACS AEM Commons project; as the feature is coming from there, they should provide the solution to this 🙂