X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fext%2Farchaeopteryx%2FAptxPhylogenyTreeTest.java;fp=test%2Fjalview%2Fext%2Farchaeopteryx%2FAptxPhylogenyTreeTest.java;h=4163e3d2fc5300dfa6167291b2612e433b921212;hb=733974a24ce2eb5755c46bbb2a41674493d04740;hp=8975d83d80601b24e4290dbc6427113ff484cec7;hpb=ef887ebe817cd6595b6275f5f51001677c377214;p=jalview.git diff --git a/test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java b/test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java index 8975d83..4163e3d 100644 --- a/test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java +++ b/test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java @@ -1,154 +1,154 @@ -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); - - } - - - - - - - -} +// 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); +// +// } +// +// +// +// +// +// +// +// }