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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to Mock WorkflowService

Avatar

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

Avatar

Correct answer by
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

Avatar

Correct answer by
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

Avatar

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