Hello!
I have a signal method which I am calling from a child workflow. I’m trying to test and verify that this method is actually getting called. Is there a way that I can mock the parent workflow that contains the signal method implementation?
Here is an example:
public class ParentWorkflowImpl implements ParentWorkflow {
private final ChildWorkflow child = Workflow.newWorkflowStub(
ChildWorkflow.class,
CHILD_WORKFLOW_OPTIONS
);
@Override
public void signalMethod() {
System.out.println("Signal method called");
}
}
public class ChildWorkflowImpl implements ChildWorkflow {
private final ChildActivities childActivities =
Workflow.newActivityStub(
ChildActivities.class,
CHILD_ACTIVITY_OPTIONS
);
@Override
public ChildResponse run(final ChildRequest request) {
...
ParentWorkflow parentWorkflow = Workflow.newExternalWorkflowStub(
ParentWorkflow.class,
String.valueOf(request.getParentWorkflowId())
);
// This is what I'm trying to verify is being called
parentWorkflow.signalMethod();
}
}
In my TestChildWorkflow
test, is it possible to mock the parent workflow in a way that verifies my signal method is being called?