How to Mock WorkflowService

Avatar

Avatar

aemg12

Avatar

aemg12

aemg12

22-09-2020

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Suraj_Kamdi

MVP

Avatar

Suraj_Kamdi

MVP

Suraj_Kamdi
MVP

23-09-2020

@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

Answers (1)

Answers (1)

Avatar

Avatar

Anudeep_Garnepudi

MVP

Avatar

Anudeep_Garnepudi

MVP

Anudeep_Garnepudi
MVP

27-10-2020

Hi @aemg12 

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

AG