// package jalview.ext.archaeopteryx; // // import static org.testng.Assert.assertEquals; // import static org.testng.Assert.assertTrue; // // import jalview.gui.Desktop; // // import org.forester.archaeopteryx.Archaeopteryx; // import org.forester.archaeopteryx.MainFrame; // import org.forester.archaeopteryx.TreePanel; // import org.forester.phylogeny.Phylogeny; // import org.forester.phylogeny.PhylogenyNode; // import org.testng.annotations.BeforeClass; // import org.testng.annotations.Test; // // public class AptxPhylogenyTreeTest extends TreeViewTest // { // final Phylogeny inputTree = new Phylogeny(); // // final PhylogenyNode rootNode = new PhylogenyNode("root"); // // final PhylogenyNode ancestor1Node = new PhylogenyNode("ancestor 1"); // // final PhylogenyNode ancestor2Node = new PhylogenyNode("leaf 2"); // // final PhylogenyNode leaf1aNode = new PhylogenyNode("leaf 1a"); // // final PhylogenyNode leaf1bNode = new PhylogenyNode("leaf 1b"); // // final PhylogenyNode leaf1cNode = new PhylogenyNode("leaf 1c"); // // Phylogeny tree; // // TreePanel treePanel; // // MainFrame aptx; // // // @Override // @BeforeClass(alwaysRun = true) // public void setUpTree() // { // ancestor1Node.addAsChild(leaf1aNode); // ancestor1Node.addAsChild(leaf1bNode); // ancestor1Node.addAsChild(leaf1cNode); // // rootNode.addAsChild(ancestor1Node); // rootNode.addAsChild(ancestor2Node); // // leaf1aNode.setDistanceToParent(2); // leaf1bNode.setDistanceToParent(3); // leaf1cNode.setDistanceToParent(4); // // ancestor1Node.setDistanceToParent(36); // ancestor2Node.setDistanceToParent(42); // // inputTree.setName("test"); // inputTree.setRoot(rootNode); // inputTree.setRooted(true); // // } // // @Override // @BeforeClass(dependsOnMethods = { "setUpJalview", "setUpTree" }) // public void createTreeView() // { // treeView = Archaeopteryx.createApplication(inputTree); // aptx = (MainFrame) treeView; // pretty ugly // treePanel = aptx.getMainPanel().getCurrentTreePanel(); // tree = treePanel.getPhylogeny(); // // Desktop.addInternalFrame(aptx, "Archaeopteryx", 500, 500); // // } // // // // @Test(groups = "Functional") // public void testMainPanelExists() // { // assertTrue(aptx.getMainPanel() != null); // } // // @Test(groups = "Functional") // public void testTreePanelExists() // { // assertTrue(treePanel != null); // } // // @Override // public void testTreeTitle() // { // assertTrue(tree.getName().equals("test")); // // } // // @Test( // groups = "Functional", // expectedExceptions = IllegalArgumentException.class) // public void testInvalidBranchName() // { // tree.getNode("I shouldn't exist"); // // } // // @Override // public void testExistingBranchName() // { // tree.getNode("leaf 2"); // // } // // @Override // public void testTreeLoaded() // { // assertTrue(tree != null); // } // // @Override // public void testChildNodesCount() // { // assertEquals(tree.getNode("ancestor 1").getNumberOfExternalNodes(), 3); // // } // // @Override // public void testChildToParentBranchLength() // { // assertEquals(tree.getNode("leaf 1a").getDistanceToParent(), 2.0); // // } // // @Override // public void testNodeToRootBranchLength() // { // assertEquals(tree.getNode("leaf 2").getDistanceToParent(), 42.0); // // } // // @Override // public void testDistantNodeToRootBranchLength() // { // assertEquals(tree.getNode("leaf 1c").calculateDistanceToRoot(), // 4.0 + 36.0); // // } // // // // // // // // }