コード例 #1
0
 @Test
 public void graphWithTwoNodesAndTwoNeighbours() throws Exception {
   Node node = new Node("1");
   node.addNeighbour(new Node("3"));
   Node node2 = new Node("2");
   node2.addNeighbour(new Node("4"));
   graph.add(node);
   graph.add(node2);
   assertEquals("1 3\n2 4\n", serializeGraph());
 }
コード例 #2
0
 @Test
 public void graphWithOneNodeAndOneNeighbourReturnsNodeAndNeighbour() throws Exception {
   Node node = new Node("1");
   node.addNeighbour(new Node("2"));
   graph.add(node);
   assertEquals("1 2\n", serializeGraph());
 }