Is it possible to mock Workflow.getInfo() method call when writing test case?

I’m writing unit test case for a child workflow.
In the childworkflow, we fetch the parent workflow id by calling Workflow.getInfo().getParentWorkflowId().

As its a unit test, I would be directly running the chlidWorkflow and there won’t be any ParentWorkflow.
Because of this Workflow.getInfo().getParentWorkflowId() will return null.

I want to mock Workflow.getInfo() saw that I can return a custom WorkflowInfo object with parent workflow id.

Is this possible?

I tried with Mockito, looks like it doens’t have any impact.

Or is it possible to set Parent workflow ID manually before starting a child workflow ?

I would recommend creating a parent workflow just for this unit test.

I am having a similar problem too. How would I create a parent workflow in the unit test

@Manoj_Sugumaran
you can create a test parent workflow (interface and impl) that invokes your child workflow thats under test and register both this test parent and your child workflow with the test env. Then start this test parent workflow in your test.

Let us know if you would need a sample for this.