JUnit and mocks - how to register MockELResolver [7.0.0.M1]

I want to implement Unit tests for a process model using mocks for service tasks:

@FlowableTest
@ConfigurationResource("flowableTest.cfg.xml")
class FlowableTest {
    private lateinit var runtimeService: RuntimeService
    private lateinit var taskService: TaskService

    private val serviceTaskExecutor: MockServiceTaskExecutor = MockServiceTaskExecutor()

    @BeforeEach
    fun setUp(mockSupport: FlowableMockSupport, processEngine: ProcessEngine) {
        this.runtimeService = processEngine.runtimeService
        this.taskService = processEngine.taskService
        runtimeService.addEventListener(eventListener)

        Mocks.register(
            "serviceTaskExecutor",
            serviceTaskExecutor,
        )
    }

    @Test
    ....
}

flowableTest.cfg.xml

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration"
          class="org.flowable.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">

        <property name="jdbcUrl" value="jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000"/>
        <property name="jdbcDriver" value="org.h2.Driver"/>
        <property name="jdbcUsername" value="sa"/>
        <property name="jdbcPassword" value=""/>

        <property name="databaseSchemaUpdate" value="true"/>

        <property name="asyncExecutorActivate" value="false"/>
        <property name="resolverFactories">
            <list>
                <bean class="org.flowable.common.engine.impl.scripting.BeansResolverFactory"/>
                <bean class="org.flowable.engine.test.mock.MockResolverFactory"/>
            </list>
        </property>
    </bean>
    <bean id="serviceTaskExecutor" class="my.tests.MockServiceTaskExecutor"/>
</beans>

The documentation for Mocks.register() says

This method lets you register a mock object. Make sure to register the MockElResolver with your process engine configuration.

but all examples (even in the javadoc) are using MockExpressionManager, which isn’t available in version 7:

public class MockResolverFactory
extends Object
implements org.flowable.common.engine.impl.scripting.ResolverFactory

This is a bridge resolver, making available any objects registered through Mocks.register(java.lang.String, java.lang.Object) inside scripts supported by process execution.

In order to use it, you need to declare it as ResolverFactory, for example by using flowable.cfg.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="processEngineConfiguration"
class="org.flowable.engine.impl.cfg. StandaloneInMemProcessEngineConfiguration">
<property name="expressionManager">
<bean class="org.flowable.engine.test.mock.MockExpressionManager" />
</property>
<property name="resolverFactories">
<list>
<bean class="org.flowable.common.engine.impl.scripting.VariableScopeResolverFactory " />
<bean class="org.flowable.common.engine.impl.scripting.BeansResolverFactory" />
<bean class="com.deenero.activiti.MockResolverFactory" />
</list>
</property>
</bean>

</beans>

or by any other means of creating configuration.

Did anyone try getting unit test with mocks to work in version 7?

Is there maybe a better way to test process models?