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

SOLVED

How to Mock WorkflowService

aemg12
Level 2
Level 2

Below is my original class 

@reference
private ResourceResolverFactory resourceResolverFactory;

@reference
private WorkflowService workflowService;

 

How can I mock the above?

I tried something like below:

 

@Mock
WorkflowService workflowServiceMock;

 

then

workflowServiceMock = context.registerInjectActivateService(workflowServiceMock);

 

But it throws NullPointerException

1 Accepted Solution
Suraj_Kamdi
Correct answer by
Community Advisor
Community Advisor

@aemg12 

Can you please paste some more snippets or logic ? So that it will be more clear to investigate why the workflow session is returning NULLPOINTER_EXCEPTION

View solution in original post

2 Replies
Suraj_Kamdi
Correct answer by
Community Advisor
Community Advisor

@aemg12 

Can you please paste some more snippets or logic ? So that it will be more clear to investigate why the workflow session is returning NULLPOINTER_EXCEPTION

View solution in original post

Anudeep_Garnepudi
Community Advisor
Community Advisor

Hi @aemg12 

Based on the code you shared, context seems to be NULL, check that. If not please share code with error stack.

AG