import beast.core.Citation; //导入依赖的package包/类
@Test
public void testBEASTi() throws Exception {
BEASTi beasti = new BEASTi();
System.err.println("test getCitation");
Citation citation = beasti.getCitation();
assertEquals("this is a dummy citation", citation.value());
citation = beasti.getCitationList().get(0);
assertEquals("this is a dummy citation", citation.value());
BEASTi beasti02 = new BEASTi2();
List<Citation> citations = beasti02.getCitationList();
assertEquals(3, citations.size());
System.err.println("test initByName");
beasti.initByName("value", "hello world");
Input<?> input = beasti.getInput("value");
assertEquals("hello world", input.get());
System.err.println("test listInputs");
List<?> list = beasti.listInputs();
assertEquals(2, list.size());
System.err.println("test initByName");
BEASTi beasti2 = new BEASTi();
beasti.initByName("value", "hello world",
"other", beasti2);
System.err.println("test getInputValue");
BEASTi beasti3 = (BEASTi) beasti.getInputValue("other");
assertEquals(beasti2, beasti3);
System.err.println("test getOutputs");
assertEquals(1, beasti2.getOutputs().size());
String description = beasti.getDescription();
assertEquals("class that impements BEASTInterface but is not a BEASTObject", description);
List<BEASTInterface> predecessors = new ArrayList<BEASTInterface>();
beasti2.getPredecessors(predecessors);
assertEquals(1, predecessors.size());
beasti.getPredecessors(predecessors);
assertEquals(2, predecessors.size());
assertEquals(beasti, predecessors.get(1));
assertEquals(beasti2, predecessors.get(0));
description = beasti.getTipText("other");
assertEquals("link to another BEASTi object", description);
boolean b = beasti.isPrimitive("value");
assertEquals(true, b);
b = beasti.isPrimitive("other");
assertEquals(false, b);
List<BEASTInterface> beastObjbects = beasti.listActiveBEASTObjects();
assertEquals(1, beastObjbects.size());
assertEquals(beasti2, beastObjbects.get(0));
beastObjbects = beasti2.listActiveBEASTObjects();
assertEquals(0, beastObjbects.size());
beasti.validateInputs();
try {
beasti2.validateInputs();
assertEquals(true, false); // should never get here
} catch (Throwable t) {
// lucky to be here
}
beasti2.setInputValue("value", "Goodbye!");
String msg = (String) beasti2.getInputValue("value");
assertEquals("Goodbye!", msg);
}
请发表评论