I have a JUnit 4 and JUnit 5 test, using the same simple BPMN model with a service task.
Both are running in the same environment.
But while the JUnit 4 test succeeds as expected, the JUnit 5 fails because of
Unknown property used in expression: ${MyServiceDelegate}. Cause: Cannot resolve identifier ‘MyServiceDelegate’
What’s wrong here with JUnit 5?
JUnit 4:
@SpringBootTest
@RunWith(SpringRunner.class)
class JUnit4MyServiceTest extends AbstractProcessEngineRuleTest {
@Autowired
public RuntimeService runtimeService;
@Test
void shouldExecuteProcess() {
final String processDefinitionKey = "MyServiceProcess"; // Id
final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinitionKey);
assertThat(processInstance)
.isStarted()
.hasPassed("RunTestStartEvent", "MyServiceTaskTask", "FinishTestEndEvent")
.isEnded();
}
}
JUnit 5
@SpringBootTest
@ExtendWith(ProcessEngineExtension.class)
@Deployment(resources = {"my-service.bpmn"})
class MyServiceTest {
private ProcessEngine processEngine;
@Test
void shouldExecuteProcess() {
final String processDefinitionKey = "MyServiceProcess"; // Id
final ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceByKey(processDefinitionKey);
assertThat(processInstance)
.isStarted()
.hasPassed("RunTestStartEvent", "MyServiceTaskTask", "FinishTestEndEvent")
.isEnded();
}
}
.