Expand my Community achievements bar.

SOLVED

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

Avatar

Level 7

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?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

2 Replies

Avatar

Community Advisor

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

Avatar

Correct answer by
Employee Advisor

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