Childworkflow test failing

I am trying to test my childworkflow. Register the workflowImpl class, register the activities impl. I start my test env and then the following error comes up exactly at the point of calling workflow method.
Error logs:

java.lang.Error: Failure instantiating workflow implementation class org.company.account.manager.workflow.impl.MyChildWorkflowImpl
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation$RootWorkflowInboundCallsInterceptor.newInstance(POJOWorkflowImplementationFactory.java:326)
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation$RootWorkflowInboundCallsInterceptor.init(POJOWorkflowImplementationFactory.java:295)
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation.initialize(POJOWorkflowImplementationFactory.java:263)
	at io.temporal.internal.sync.SyncWorkflow.lambda$start$1(SyncWorkflow.java:114)
	at io.temporal.internal.sync.CancellationScopeImpl.run(CancellationScopeImpl.java:102)
	at io.temporal.internal.sync.WorkflowThreadImpl$RunnableWrapper.run(WorkflowThreadImpl.java:106)
	at io.temporal.worker.ActiveThreadReportingExecutor.lambda$submit$0(ActiveThreadReportingExecutor.java:53)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NoSuchMethodException: org.company.account.manager.workflow.impl.MyChildWorkflowImpl.<init>()
	at java.base/java.lang.Class.getConstructor0(Class.java:3349)
	at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2553)
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation$RootWorkflowInboundCallsInterceptor.newInstance(POJOWorkflowImplementationFactory.java:318)
	... 11 common frames omitted

Also, the first line of my child workflow uses Workflow.await(Duration, unblock_condition) if that helps

Does the child workflow class have a public no arguments constructor?

No. It doesn’t. I annotated it with just @RequiredArgsConstructor owning to the fact that all it’s fields are final. How does it matter though ? I had the parent workflow with the same @RequiredArgsConstructor and the tests worked just fine there.

I don’t know much about these annotations. But Temporal uses reflection to instantiate a workflow object using non argument constructor. So any class that doesn’t provide such a constructor cannot be used as a workflow implementation.

Hi Maxim, thanks for the answer, I moved ahead by introducing a no-args constructor to my workflow impl. However, My workflow has some fields that were autowired with beans.
In my test env, I want those beans to be mocked and injected to my workflow implementation. how can I achieve that ? currently I am getting those fields as null. I am using spring-boot

We don’t recommend using dependency injection with workflows. Workflow code must be deterministic and injection can break it easily in subtle ways.

What is the use case for injecting fields into the workflow object?

Was not well versed with this being a non-deterministic thing. Have now wrapped up my logic, that required bean autowiring, inside activities. It works fine now. Probably I was writing code for workflows the wrong way.