@Test(expected = NullPointerException.class) public void toElement() { PropertyWriter propertyWriter = tested.toElement(node); verify(writer).setName(NAME); verify(writer).setType(TYPE); verify(writer).setAbsoluteBounds(node); assertEquals(writer, propertyWriter); Node<View<DataObject>, ?> node2 = new NodeImpl<>(UUID.uuid()); node2.setContent(dataObjectView2); TextAnnotation textAnnotation = new TextAnnotation(); when(dataObjectView2.getDefinition()).thenReturn(null); PropertyWriter propertyWriter2 = tested.toElement(node2); }
public PropertyWriter toElement(Node<View<DataObject>, ?> node) { final DataObject def = node.getContent().getDefinition(); if (def != null) { DataObjectReference element = bpmn2.createDataObjectReference(); element.setId(node.getUUID()); DataObjectPropertyWriter writer = propertyWriterFactory.of(element); DataObject definition = node.getContent().getDefinition(); writer.setName(StringUtils.replaceIllegalCharsAttribute(StringUtils.replaceIllegalCharsForDataObjects(definition.getName().getValue()))); writer.setType(definition.getType().getValue().getType()); writer.setAbsoluteBounds(node); return writer; } return ConverterUtils.notSupported(def); }
DataObjectConverter { public PropertyWriter toElement(Node<View<DataObject>, ?> node) { final DataObject def = node.getContent().getDefinition(); if (def != null) { DataObjectReference element = bpmn2.createDataObjectReference(); element.setId(node.getUUID()); DataObjectPropertyWriter writer = propertyWriterFactory.of(element); DataObject definition = node.getContent().getDefinition(); writer.setName(StringUtils.replaceIllegalCharsAttribute(StringUtils.replaceIllegalCharsForDataObjects(definition.getName().getValue()))); writer.setType(definition.getType().getValue().getType()); writer.setAbsoluteBounds(node); return writer; } return ConverterUtils.notSupported(def); } }
DataObjectConverter { public PropertyWriter toElement(Node<View<DataObject>, ?> node) { final DataObject def = node.getContent().getDefinition(); if (def != null) { DataObjectReference element = bpmn2.createDataObjectReference(); element.setId(node.getUUID()); DataObjectPropertyWriter writer = propertyWriterFactory.of(element); DataObject definition = node.getContent().getDefinition(); writer.setName(StringUtils.replaceIllegalCharsAttribute(StringUtils.replaceIllegalCharsForDataObjects(definition.getName().getValue()))); writer.setType(definition.getType().getValue().getType()); writer.setAbsoluteBounds(node); return writer; } return ConverterUtils.notSupported(def); } DataObjectConverter(PropertyWriterFactory propertyWriterFactory); }
DataObjectConverter { public PropertyWriter toElement(Node<View<DataObject>, ?> node) { final DataObject def = node.getContent().getDefinition(); if (def != null) { DataObjectReference element = bpmn2.createDataObjectReference(); element.setId(node.getUUID()); DataObjectPropertyWriter writer = propertyWriterFactory.of(element); DataObject definition = node.getContent().getDefinition(); writer.setName(StringUtils.replaceIllegalCharsAttribute(StringUtils.replaceIllegalCharsForDataObjects(definition.getName().getValue()))); writer.setType(definition.getType().getValue().getType()); writer.setAbsoluteBounds(node); return writer; } return ConverterUtils.notSupported(def); } DataObjectConverter(PropertyWriterFactory propertyWriterFactory); PropertyWriter toElement(Node<View<DataObject>, ?> node); }
DataObjectConverter { public PropertyWriter toElement(Node<View<DataObject>, ?> node) { final DataObject def = node.getContent().getDefinition(); if (def != null) { DataObjectReference element = bpmn2.createDataObjectReference(); element.setId(node.getUUID()); DataObjectPropertyWriter writer = propertyWriterFactory.of(element); DataObject definition = node.getContent().getDefinition(); writer.setName(StringUtils.replaceIllegalCharsAttribute(StringUtils.replaceIllegalCharsForDataObjects(definition.getName().getValue()))); writer.setType(definition.getType().getValue().getType()); writer.setAbsoluteBounds(node); return writer; } return ConverterUtils.notSupported(def); } DataObjectConverter(PropertyWriterFactory propertyWriterFactory); PropertyWriter toElement(Node<View<DataObject>, ?> node);  }