コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

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 受け入れられたソリューション

Avatar

正解者
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

元の投稿で解決策を見る

2 返信

Avatar

Community Advisor and Adobe Champion

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

Avatar

正解者
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