@Test
public void testGetOrCreateNodeByName() {

    Node node = new Node("x");
    assertThat(graph.hasNode("x"), is(false));
    Node x = graph.getOrCreateNodeByName("x");
    assertEquals(node, x);
    assertNotSame(node, x);
    assertThat(graph.hasNode("x"), is(true));
    // will not be created a second time:
    Node y = graph.getOrCreateNodeByName("x");
    assertSame(x, y);
}