Strange implementation of ProcessEngineRule

I had some trouble mocking dependencies of a process engine plugin and found out that the problem is that the ProcessEngineRule does not work as I would expect from a JUnit Rule, namely:

The ProcessEngineRule initializes the process engine directly inside the apply() method . I would have expect that this initialization happens inside the Statement returned from apply() instead.

Does anyone know if there is a specific reason for this?

The problem with this is that the rules are applied in the reverse order (inner rules are applied before outer rules). So to mock the dependency of my plugin, I have to implement the dependency mocking rules similar to the ProcessEngineRule (mock directly in apply()) and then order those rules after the ProcessEngineRule (to have them applied before).
Alternatively, I could inherit from ProcessEngineRule and “fix” the apply() implementation… :thinking: