import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.gui.JvOptionPane;
-
import org.forester.archaeopteryx.MainFrame;
import org.forester.archaeopteryx.TreePanel;
import org.forester.phylogeny.Phylogeny;
@BeforeClass(dependsOnMethods = { "setUpJalview", "setUpTree" })
public void createTreeView()
{
-
treeView = ArchaeopteryxInit.createInstance(inputTree);
aptx = (MainFrame) treeView; // pretty ugly
treePanel = aptx.getMainPanel().getCurrentTreePanel();
}
- @BeforeClass(alwaysRun = true)
- public void setUpJvOptionPane()
- {
- JvOptionPane.setInteractiveMode(false);
- JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
- }
@Test(groups = "Functional")
public void testMainPanelExists()
@Test(groups = "Functional")
public void testTreePanelExists()
{
- assertTrue(aptx.getMainPanel().getCurrentTreePanel() != null);
+ assertTrue(treePanel != null);
}
- @Override
@Test(
groups = "Functional",
expectedExceptions = IllegalArgumentException.class)
}
@Override
- @Test(groups = "Functional")
public void testExistingBranchName()
{
tree.getNode("leaf 2");
}
@Override
- @Test(groups = "Functional")
public void testTreeLoaded()
{
- assertTrue(aptx.getMainPanel().getCurrentTreePanel()
- .getPhylogeny() != null);
+ assertTrue(tree != null);
}
@Override
- @Test(groups = "Functional")
public void testChildNodesCount()
{
assertEquals(tree.getNode("ancestor 1").getNumberOfExternalNodes(), 3);
}
@Override
- @Test(groups = "Functional")
public void testChildToParentBranchLength()
{
assertEquals(tree.getNode("leaf 1a").getDistanceToParent(), 2.0);
}
@Override
- @Test(groups = "Functional")
public void testNodeToRootBranchLength()
{
assertEquals(tree.getNode("leaf 2").getDistanceToParent(), 42.0);
}
@Override
- @Test(groups = "Functional")
public void testDistantNodeToRootBranchLength()
{
assertEquals(tree.getNode("leaf 1c").calculateDistanceToRoot(),
import jalview.bin.Jalview;
import jalview.gui.Desktop;
+import jalview.gui.JvOptionPane;
import javax.swing.JInternalFrame;
public abstract class TreeViewTest
{
-
Jalview jalview;
JInternalFrame treeView;
@BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
public abstract void setUpTree();
@BeforeClass(alwaysRun = true)
Jalview.main(args);
}
- @BeforeClass(dependsOnMethods = { "setUpJalview", "setUpTree" })
public abstract void createTreeView();
@Test(groups = "Functional")
assertTrue(treeView.isShowing());
}
- @Test(
- groups = "Functional",
- expectedExceptions = IllegalArgumentException.class)
- public abstract void testInvalidBranchName();
-
@Test(groups = "Functional")
public abstract void testTreeLoaded();