@Test public void testConstruction() { UndirectedGraph abc = new UndirectedGraph(); assertEquals(0, abc.size()); assertTrue(abc.isEmpty()); assertEquals(Arrays.asList(), abc.getNodes()); }
@Test public void testCombined() { UndirectedGraphNode a = new UndirectedGraphNode("A"); UndirectedGraphNode b = new UndirectedGraphNode("B"); UndirectedGraphNode c = new UndirectedGraphNode("C"); test.addNode(a); assertEquals(1, test.size()); test.addNode(b); assertEquals(2, test.size()); test.addNode(c); assertEquals(3, test.size()); assertEquals(Arrays.asList(a, b, c), test.getNodes()); test.removeNode(a); // System.out.println(test.getNodes()); assertEquals(2, test.size()); test.removeNode(b); // System.out.println(test.getNodes()); assertEquals(1, test.size()); test.removeNode(c); // System.out.println(test.getNodes()); assertEquals(0, test.size()); assertTrue(test.isEmpty()); }