### Question:
ArtifactsConverter implements NodeConverter<org.eclipse.bpmn2.FlowElement> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element) { return Match.of(FlowElement.class, BpmnNode.class) .when(org.eclipse.bpmn2.TextAnnotation.class, this::toTextAnnotation) .when(org.eclipse.bpmn2.DataObjectReference.class, this::toDataObject) .apply(element); } ArtifactsConverter(TypedFactoryManager typedFactoryManager, PropertyReaderFactory propertyReaderFactory); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.FlowElement element);  }### Answer:
@Test public void convertTextAnnotation() { TextAnnotation element = Bpmn2Factory.eINSTANCE.createTextAnnotation(); when(typedFactoryManager.newNode(anyString(), eq(org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation.class))).thenReturn(nodeTextAnnotation); when(nodeTextAnnotation.getContent()).thenReturn(contentTextAnnotation); when(contentTextAnnotation.getDefinition()).thenReturn(defTextAnnotation); when(propertyReaderFactory.of(element)).thenReturn(readerTextAnnotation); final Result<BpmnNode> node = tested.convert(element); final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value(); assertEquals(contentTextAnnotation, value.getContent()); assertEquals(defTextAnnotation, value.getContent().getDefinition()); }
@Test public void convertDataObject() { DataObjectReference element = Bpmn2Factory.eINSTANCE.createDataObjectReference(); when(typedFactoryManager.newNode(anyString(), eq(org.kie.workbench.common.stunner.bpmn.definition.DataObject.class))).thenReturn(nodeDataObject); when(nodeDataObject.getContent()).thenReturn(contentDataObject); when(contentDataObject.getDefinition()).thenReturn(defDataObject); when(propertyReaderFactory.of(element)).thenReturn(readerDataObject); final Result<BpmnNode> node = tested.convert(element); final Node<? extends View<? extends BPMNViewDefinition>, ?> value = node.value().value(); assertEquals(contentDataObject, value.getContent()); assertEquals(defDataObject, value.getContent().getDefinition()); }