예제 #1
0
 /** Test for {@link TopologyMap#removeNode()}. */
 public final void testRemoveNode() {
   TopologyMap graph = new TopologyMap(NODE_2);
   graph.addNode(NODE_1);
   graph.removeNode(NODE_2);
   graph.removeNode((TopologyNode) null);
   assertTrue(graph.containsNode(NODE_1));
   graph.removeNode(NODE_1);
   assertFalse(graph.containsNode(NODE_1));
 }
예제 #2
0
  /** Test for {@link TopologyMap#removeNode()}. */
  public final void testRemoveNode2() {
    TopologyMap graph = new TopologyMap(NODE_2);
    graph.addNode(NODE_1);
    graph.addNode(NODE_3);

    graph.addLink(NODE_1, NODE_2, CONNECTION_ID_1);
    graph.addLink(NODE_2, NODE_1, CONNECTION_ID_1);

    graph.addLink(NODE_2, NODE_3, CONNECTION_ID_1);
    graph.addLink(NODE_3, NODE_2, CONNECTION_ID_1);

    assertEquals(4, graph.getLinkCount());
    graph.removeNode(NODE_1);
    graph.removeNode(new TopologyNode(NODE_1));
    assertEquals(2, graph.getNodeCount());
    assertEquals(2, graph.getLinkCount());
  }