import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.bin.Jalview;
-import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import org.forester.archaeopteryx.MainFrame;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-public class AptxPhylogenyTreeTest
+public class AptxPhylogenyTreeTest extends TreeViewTest
{
final Phylogeny inputTree = new Phylogeny();
final PhylogenyNode ancestor1Node = new PhylogenyNode("ancestor 1");
- final PhylogenyNode ancestor2Node = new PhylogenyNode("ancestor 2");
+ final PhylogenyNode ancestor2Node = new PhylogenyNode("leaf 2");
final PhylogenyNode leaf1aNode = new PhylogenyNode("leaf 1a");
final PhylogenyNode leaf1cNode = new PhylogenyNode("leaf 1c");
- TreePanel treePanel;
-
Phylogeny tree;
+ TreePanel treePanel;
+
MainFrame aptx;
- Jalview jalview;
+ @Override
@BeforeClass(alwaysRun = true)
public void setUpTree()
{
}
- @BeforeClass(dependsOnMethods = { "setUpTree" })
- public void setUpJalview()
+ @BeforeClass(dependsOnMethods = { "setUpJalview", "setUpTree" })
+ public void createTreeView()
{
- String[] args = new String[0];
- Jalview.main(args);
- aptx = ArchaeopteryxInit.createInstance(inputTree);
+ treeView = ArchaeopteryxInit.createInstance(inputTree);
+ aptx = (MainFrame) treeView; // pretty ugly
treePanel = aptx.getMainPanel().getCurrentTreePanel();
tree = treePanel.getPhylogeny();
}
}
@Test(groups = "Functional")
- public void testAptxExists()
- {
- assertTrue(aptx != null);
- }
-
-
- @Test(groups = "Functional")
- public void testAptxBoundToJalview()
- {
- assertTrue(aptx.getTopLevelAncestor() instanceof Desktop);
- }
-
- @Test(groups = "Functional")
- public void testShowingAptx()
- {
- assertTrue(aptx.isShowing());
-
- }
-
- @Test(groups = "Functional")
public void testMainPanelExists()
{
assertTrue(aptx.getMainPanel() != null);
assertTrue(aptx.getMainPanel().getCurrentTreePanel() != null);
}
+ @Override
@Test(groups = "Functional")
public void testTreeLoaded()
{
- assertTrue(aptx.getMainPanel().getCurrentTreePanel() != null);
+ assertTrue(aptx.getMainPanel().getCurrentTreePanel()
+ .getPhylogeny() != null);
}
+ @Override
@Test(groups = "Functional")
public void testChildNodesCount()
{
}
+ @Override
@Test(groups = "Functional")
- public void testCorrectLeafToParentBranchLength()
+ public void testChildToParentBranchLength()
{
assertEquals(tree.getNode("leaf 1a").getDistanceToParent(), 2.0);
}
+ @Override
@Test(groups = "Functional")
- public void testCorrectAncestorLeafToRootBranchLength()
+ public void testNodeToRootBranchLength()
{
- assertEquals(tree.getNode("ancestor 2").getDistanceToParent(), 42.0);
+ assertEquals(tree.getNode("leaf 2").getDistanceToParent(), 42.0);
}
+ @Override
@Test(groups = "Functional")
- public void testCorrectLeafToRootBranchLength()
+ public void testDistantNodeToRootBranchLength()
{
assertEquals(tree.getNode("leaf 1c").calculateDistanceToRoot(),
4.0 + 36.0);