@Test
public void testReplace() {

	final SimpleNode in = new SimpleNode("in");
	final SimpleNode a = new SimpleNode("a", in);
	final SimpleNode b = new SimpleNode("b", in);
	final SimpleNode out = new SimpleNode("out", a, b);
	final SimpleNode in2 = new SimpleNode("in2");
	in2.outgoings.add(b);
	final Graph<SimpleNode> graph = new Graph<SimpleNode>(new SimpleNodeModifier(), in, in2);
	final SimpleNode replacement = new SimpleNode("replaced");
	graph.replace(out, replacement, false);
	final ArrayList<SimpleNode> retrievedNodes = new ArrayList<SimpleNode>();
	for (final Graph<SimpleNode>.NodePath nodePath : graph)
		retrievedNodes.add(nodePath.getNode());
	final List<SimpleNode> expected = Arrays.asList(in, a, replacement, b, replacement, in2, b, replacement);
	Assert.assertEquals(expected, retrievedNodes);
}