### Question:
ArtifactsConverter { public PropertyWriter toElement(Node<View<BaseArtifacts>, ?> node) { return NodeMatch.fromNode(BaseArtifacts.class, PropertyWriter.class) .when(TextAnnotation.class, this::toTextAnnotation) .when(DataObject.class, this::toDataObjectAnnotation) .ignore(Object.class) .apply(node) .value(); } ArtifactsConverter(PropertyWriterFactory propertyWriterFactory); PropertyWriter toElement(Node<View<BaseArtifacts>, ?> node);  }### Answer:
@Test public void toTextAnnotationElement() { textAnnotation = new TextAnnotation(); textAnnotation.getGeneral().getDocumentation().setValue(DOC); textAnnotation.getGeneral().getName().setValue(NAME); textAnnotationNode = new NodeImpl<>(UUID.uuid()); textAnnotationNode.setContent(textAnnotationView); when(textAnnotationView.getDefinition()).thenReturn(textAnnotation); when(propertyWriterFactory.of(any(org.eclipse.bpmn2.TextAnnotation.class))).thenReturn(textAnnotationWriter); artifactsConverter = new ArtifactsConverter(propertyWriterFactory); PropertyWriter propertyWriter = artifactsConverter.toElement(((NodeImpl) textAnnotationNode)); verify(textAnnotationWriter).setName(NAME); verify(textAnnotationWriter).setDocumentation(DOC); verify(textAnnotationWriter).setAbsoluteBounds(textAnnotationNode); assertEquals(textAnnotationWriter, propertyWriter); }
@Test public void toDataObjectElement() { dataObject = new DataObject(); dataObject.getGeneral().getDocumentation().setValue(DOC); dataObject.setName(new Name(NAME)); dataObject.setType(new DataObjectType(new DataObjectTypeValue(NAME))); dataObjectNode = new NodeImpl<>(UUID.uuid()); dataObjectNode.setContent(dataObjectView); when(dataObjectView.getDefinition()).thenReturn(dataObject); when(propertyWriterFactory.of(any(org.eclipse.bpmn2.DataObjectReference.class))).thenReturn(dataObjectWriter); artifactsConverter = new ArtifactsConverter(propertyWriterFactory); PropertyWriter propertyWriter = artifactsConverter.toElement(((NodeImpl) dataObjectNode)); verify(dataObjectWriter).setName(NAME); verify(dataObjectWriter).setType(NAME); verify(dataObjectWriter).setAbsoluteBounds(dataObjectNode); assertEquals(dataObjectWriter, propertyWriter); }