private void assertFlowElementIs(Class<? extends FlowElement> elementClass) {
BpmnModelInstance modelInstance = ModelExecutionContextExecutionListener.modelInstance;
assertNotNull(modelInstance);
Model model = modelInstance.getModel();
Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(Event.class));
assertEquals(3, events.size());
Collection<ModelElementInstance> gateways = modelInstance.getModelElementsByType(model.getType(Gateway.class));
assertEquals(1, gateways.size());
Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(Task.class));
assertEquals(1, tasks.size());
FlowElement flowElement = ModelExecutionContextExecutionListener.flowElement;
assertNotNull(flowElement);
assertTrue(elementClass.isAssignableFrom(flowElement.getClass()));