GraphElementFactory implements VertexProvider<Node>, EdgeProvider<Node, Edge> { @Override public Node buildVertex(final String name, final Map<String, Attribute> nodeAttributes) { try { return createNode(name, extractLabels(nodeAttributes), convertAttributes(nodeAttributes)); } catch (final NoSuchClassException e) { throw new JpaUnitException(e); } } GraphElementFactory(final List<Class<?>> entityClasses); @Override Edge buildEdge(final Node from, final Node to, final String name, final Map<String, Attribute> edgeAttributes); Edge createEdge(final Node from, final Node to, final String name, final List<String> labels,
            final Map<String, Object> attributesMap); @Override Node buildVertex(final String name, final Map<String, Attribute> nodeAttributes); Node createNode(final String name, final List<String> labels, final Map<String, Object> attributesMap);  }
@Test public void testBuildVertex() { final String nodeId = "a"; final Map<String, eu.drus.jpa.unit.neo4j.dataset.graphml.Attribute> nodeAttributes = ImmutableMap.<String, eu.drus.jpa.unit.neo4j.dataset.graphml.Attribute>builder() .put("id", new DefaultAttribute<>(1L, AttributeType.LONG)).put("value", new DefaultAttribute<>("foo", AttributeType.STRING)) .put("labels", new DefaultAttribute<>("A", AttributeType.STRING)).build(); final Node node = factory.buildVertex(nodeId, nodeAttributes); assertThat(node, notNullValue()); assertThat(node.getId(), equalTo(nodeId)); assertThat(node.getLabels(), equalTo(Arrays.asList("A"))); assertThat(node.getAttributes().size(), equalTo(2)); final Attribute idAttribute = node.getAttributes().get(0); assertThat(idAttribute.getName(), equalTo("id")); assertThat(idAttribute.getValue(), equalTo(1l)); assertThat(idAttribute.isId(), equalTo(Boolean.TRUE)); final Attribute valueAttribute = node.getAttributes().get(1); assertThat(valueAttribute.getName(), equalTo("value")); assertThat(valueAttribute.getValue(), equalTo("foo")); assertThat(valueAttribute.isId(), equalTo(Boolean.FALSE)); }