@Test
 @Transactional
 public void shouldCreateRelationshipWithProperty() throws Exception {
   Relationship relationship =
       neo4jTemplate.createRelationshipBetween(referenceNode, node1, "has", map("name", "rel2"));
   assertNotNull(relationship);
   assertEquals(referenceNode, relationship.getStartNode());
   assertEquals(node1, relationship.getEndNode());
   assertEquals(HAS.name(), relationship.getType().name());
   assertEquals("rel2", relationship.getProperty("name", "not set"));
 }
  @Test
  public void testCreateRelationshipToNodeOutsideofBatch() throws Exception {
    final Node node1 = restAPI.createNode(map());
    final Transaction tx = restAPI.beginTx();

    Node node2 = restAPI.createNode(map());
    final Relationship relationship =
        node1.createRelationshipTo(node2, DynamicRelationshipType.withName("foo"));

    tx.success();
    tx.finish();
    assertEquals("foo", relationship.getType().name());
    assertEquals(
        "foo", getGraphDatabase().getRelationshipById(relationship.getId()).getType().name());
  }