How to Mock WorkflowService | Community
Skip to main content
Level 2
Sep 23, 2020 5:54 AM UTC
Solved

How to Mock WorkflowService

Below is my original class 

@3214626
private ResourceResolverFactory resourceResolverFactory;

@3214626
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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Suraj_Kamdi
Suraj_KamdiAccepted solution
New Participant
Sep 23, 2020 8:31 AM UTC

@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

2 replies

Anudeep_Garnepudi
New Participant
Oct 27, 2020 12:10 PM UTC

Hi @aemg12 

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

AG

Translate
Suraj_Kamdi
Suraj_KamdiAccepted solution
New Participant
Sep 23, 2020 8:31 AM UTC

@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

Translate