@Test public void testAddNode() { graph.addNode('E'); // Duplicate assertEquals(ORIGINAL_NUMBER_OF_NODES, graph.getNumberOfNodes()); graph.addNode('H'); assertEquals(ORIGINAL_NUMBER_OF_NODES + 1, graph.getNumberOfNodes()); assertEquals(ORIGINAL_NUMBER_OF_EDGES, graph.getNumberOfEdges()); assertEquals(ORIGINAL_EDGE_WEIGHT, graph.getTotalEdgeWeight()); }
@Before public void setUp() { graph.addNode('A'); graph.addNode('B'); graph.addNode('C'); graph.addNode('D'); graph.addNode('E'); graph.addNode('F'); graph.addNode('G'); graph.connectNodes('A', 'B', 2); graph.connectNodes('A', 'C', 4); graph.connectNodes('A', 'D', 1); graph.connectNodes('B', 'D', 3); graph.connectNodes('B', 'E', 10); graph.connectNodes('C', 'D', 2); graph.connectNodes('C', 'F', 5); graph.connectNodes('D', 'E', 7); graph.connectNodes('D', 'F', 8); graph.connectNodes('D', 'G', 4); graph.connectNodes('E', 'G', 6); graph.connectNodes('F', 'G', 1); }