Hi Tina,
I looked at the code and can confirm the behavior.
To use the Mocks class, you have to configure another ExpressionManager, namely org.camunda.bpm.engine.test.mock.MockExpressionManager. Even if you have that, the expression won't resolve to your mock, because the MockExpressionManager registers the mock resolver after the variable scope resolver. What you could do to work around this, is to create a custom ExpressionManager that does the same as MockExpressionManager but registers the ELResolvers in the correct order.
Still, I think using the Mocks class is probably not a good option anyway because you only mock a very tiny fraction of the engine but other than that use the engine as it is. This is quite fragile since now there are two kinds of executions: the one you mocked and the one that the engine uses internally. Depending on your processes, your mock may not represent the actual engine state.
If all you want to do is test a JavaDelegate implementation in isolation, I would advise to mock DelegateExecution and explicitly call JavaDelegate#execute(DelegateExecution) in your test code. In order to have this working with field expressions, you would have to set them beforehand, for example by adding setters for the expressions and mocking them.
In a nutshell: Use mocks when you test a delegate in isolation. When you need the engine for an "integration test" of the delegate in the actual process, do not mock but set the variable explicitly on the execution.
Cheers,
Thorben