Camunda JUnit not working with Delegate class referenced as Delegate Expression

Hi Experts

I am trying to run a simple Junit test case where the service task refers a delegate class using Delegate Expression ${calculateInterestService}.

When I run the test case, it gives the following error.

[main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: Unknown property used in expression: ${calculateInterestService}. Cause: Cannot resolve identifier ‘calculateInterestService’

But the same test case works fine, when I refer the delegate as a Java class (by providing the complete class name).

What am I missing here. Please advise.


Are you using Camunda as an embedded engine with Spring Boot?
In that case, you may register the delegates before the test.
Check out the following example by @jonathan.lukas:

1 Like