/** Will fail if it doesn't find the specified interaction. */ protected void findInteraction( CyNetwork net, String source, String target, String interaction, int count) { for (CyNode n : net.getNodeList()) { String sname = net.getRow(n).get(CyNetwork.NAME, String.class); assertNotNull("Source name is NULL", sname); if (source.equals(sname)) { List<CyNode> neigh = net.getNeighborList(n, CyEdge.Type.ANY); assertEquals("wrong number of neighbors", count, neigh.size()); for (CyNode nn : neigh) { String tname = net.getRow(nn).get(CyNetwork.NAME, String.class); assertNotNull("Target name is NULL", tname); if (tname.equals(target)) { List<CyEdge> con = net.getConnectingEdgeList(n, nn, CyEdge.Type.ANY); assertTrue("Connecting edge list is empty", con.size() > 0); for (CyEdge e : con) { String inter = net.getRow(e).get(CyEdge.INTERACTION, String.class); assertNotNull("Edge interaction is NULL", inter); if (inter.equals(interaction)) { return; } } } } } } fail("couldn't find interaction: " + source + " " + interaction + " " + target); }