コード例 #1
0
 @Test
 public void testGetIndex() {
   CyNode n1 = net.addNode();
   CyNode n2 = net.addNode();
   assertTrue("index >= 0", n1.getSUID() >= 0);
   assertTrue("index >= 0", n2.getSUID() >= 0);
 }
コード例 #2
0
 // self nested networks are allowed
 @Test
 public void testSetSelfNestedNetwork() {
   CyNode n1 = net.addNode();
   n1.setNetworkPointer(net);
   assertNotNull(n1.getNetworkPointer());
   assertEquals(net, n1.getNetworkPointer());
 }
コード例 #3
0
 @Test
 public void testSetNestedNetwork() {
   CyNode n1 = net.addNode();
   CyNetwork net2 = mock(CyNetwork.class);
   n1.setNetworkPointer(net2);
   assertNotNull(n1.getNetworkPointer());
   assertEquals(net2, n1.getNetworkPointer());
 }
コード例 #4
0
 @Test
 public void testRemoveNodeIndexStaysConstant() {
   assertEquals(0, net.getNodeCount());
   CyNode n0 = net.addNode();
   CyNode n1 = net.addNode();
   long n0i = n0.getSUID();
   long n1i = n1.getSUID();
   net.removeNodes(Collections.singletonList(n0));
   long nnli = n1.getSUID();
   assertEquals(nnli, n1i);
 }
コード例 #5
0
 @Test
 public void testRemoveNodeGetNodeFromIndex() {
   assertEquals(0, net.getNodeCount());
   CyNode n0 = net.addNode();
   CyNode n1 = net.addNode();
   long n0i = n0.getSUID();
   long n1i = n1.getSUID();
   assertEquals(net.getNode(n0i), n0);
   assertEquals(net.getNode(n1i), n1);
   assertTrue(net.removeNodes(Collections.singletonList(n0)));
   assertNull(net.getNode(n0i));
   assertEquals(n1, net.getNode(n1i));
 }
コード例 #6
0
  // null nested networks are allowed
  @Test
  public void testSetNullNestedNetwork() {
    CyNode n1 = net.addNode();

    // put a real network here first
    CyNetwork net2 = mock(CyNetwork.class);
    n1.setNetworkPointer(net2);
    assertNotNull(n1.getNetworkPointer());
    assertEquals(net2, n1.getNetworkPointer());

    // now put a null network to verify that we've "unset" things
    n1.setNetworkPointer(null);
    assertNull(n1.getNetworkPointer());
  }
コード例 #7
0
 // by default a node should have a null nested network
 @Test
 public void testInitGetNestedNetwork() {
   CyNode n1 = net.addNode();
   assertNull(n1.getNetworkPointer());
 }
コード例 #8
0
 @Test
 public void testDefaultAttributes() {
   CyNode n1 = net.addNode();
   assertEquals(String.class, net.getRow(n1).getTable().getColumn("name").getType());
   assertEquals(Boolean.class, net.getRow(n1).getTable().getColumn("selected").getType());
 }