Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

EugeneF1
Community profile EugeneF1 Level 1
Job title here
Location here
3 BADGES
Level 1

Level 1

Learn more
Joined the community 25-01-2021 1:15:24 PM
Offline
Top badges earned by EugeneF1
Customize the badges you want to showcase on your profile
Re: How to set runmodes for the sling servlet unit test -...
Avatar
Give Back
Level 1
EugeneF1
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Give Back
Ignite 1
Boost 1
View profile
EugeneF1
- Adobe Experience Manager
I've come up with the working solution 🙂Runmodes are passed to the servlet. Here's the example: private DataUpdate servlet;@Mockprivate MockSlingHttpServletRequest req;@Mockprivate SlingSettingsService settingsService;@Mockprivate SlingSettingsService settingsService;@BeforeEachvoid setUp() { servlet = context.registerInjectActivateService(new DataUpdate());} @Testvoid doGet() throws ServletException, IOException { context.runMode("author"); req = context.request(); res = context.response(); se...

Views

112

Like

1

Replies

0
Re: How to set runmodes for the sling servlet unit test -...
Avatar
Give Back
Level 1
EugeneF1
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Give Back
Ignite 1
Boost 1
View profile
EugeneF1
- Adobe Experience Manager
Your code didn't work for me. I was getting Nullpointer on context.registerService(SlingSettingsService.class,settingsService);

Views

111

Likes

0

Replies

0
How to set runmodes for the sling servlet unit test - Junit5?
Avatar
Give Back
Level 1
EugeneF1
Level 1

Like

1 like

Total Posts

3 posts

Correct reply

0 solutions
Top badges earned
Give Back
Ignite 1
Boost 1
View profile
EugeneF1
- Adobe Experience Manager
I'm using SlingSettingsService to get runmides in the sling servlet. Any idea how to set runmodes in the test file uisng Junit5 so the servlet could read them when you run doGet(req, res) test? Thanks,Eugene

Views

153

Likes

0

Replies

3
Likes from