示例#1
0
 /** Tests empty input. */
 @Test(expected = NoSuchElementException.class)
 public void testParseNewickEmpty() {
   try {
     TreeParser tp = new TreeParser(getFile(false));
     tp.parse();
   } catch (IOException e) {
     fail("Shouldn't happen");
   }
 }
示例#2
0
 /** Tests a good weather situation, where the input is of the correct format. */
 @Test
 public void testParseNewickGood() {
   try {
     // CHECKSTYLE.OFF: MagicNumber
     TreeParser tp = new TreeParser(getFile(true));
     TreeNode root = tp.parse();
     assertEquals(root.getChildren().size(), 2);
     assertEquals(root.getName(), null);
     assertTrue(Double.compare(root.getDistance(), 0.1) == 0);
     assertEquals(root.getParent(), null);
     // CHECKSTYLE.ON: MagicNumber
   } catch (IOException e) {
     fail("Shouldn't happen.");
   }
 }