Example #1
0
 protected void compareTreeItem(Treeitem item) throws EmulationException {
   Treerow row = null;
   for (Object obj : item.getChildren()) {
     if (obj instanceof Treerow) {
       row = (Treerow) obj;
       break;
     }
   }
   int counter = 0;
   for (Object obj : row.getChildren()) {
     if (obj instanceof Treecell) {
       if (counter >= _values.length) {
         fail(
             "Tree contains more items than specified in file. File: "
                 + _reader.getFileName()
                 + " Row: "
                 + _row);
       }
       assertEquals(
           "Tree item doesn't match. File: " + _reader.getFileName() + " Row: " + _row,
           _values[counter++],
           TreeUtil.getColumnText((Treecell) obj));
     }
   }
   if (counter < _values.length) {
     fail(
         "Tree contains less items than specified in file. File: "
             + _reader.getFileName()
             + " Row: "
             + _row);
   }
   compareTreeChildren(item);
 }
Example #2
0
  public void compareTree(Tree tree) throws EmulationException {
    List<Treeitem> children = new ArrayList<Treeitem>();
    if (tree.getTreechildren() != null && tree.getTreechildren().getChildren() != null) {
      children = tree.getTreechildren().getChildren();
    }

    // assertEquals("Wrong tree items count. Dump file:" + _reader.getFileName(),
    // _reader.rootNodesSize(), tree.getItems().size());
    assertEquals("Wrong tree rows count. Dump file:" + _reader.getFileName(), 0, tree.getRows());
    assertEquals(
        "Wrong root children count. Dump file:" + _reader.getFileName(),
        _children.size(),
        children.size());
    for (int i = 0; i < _children.size(); i++) {
      _children.get(i).compareTreeItem(children.get(i));
    }
  }
Example #3
0
 protected void compareTreeChildren(Treeitem item) throws EmulationException {
   List<Treeitem> children = new ArrayList<Treeitem>();
   if (!item.isOpen()) {
     new org.tsc.emulation.components.Treeitem(item).open();
   }
   if (item.getTreechildren() != null && item.getTreechildren().getChildren() != null) {
     children = item.getTreechildren().getChildren();
   }
   assertEquals(
       "Wrong children count at row " + _row + ". File " + _reader.getFileName(),
       _children.size(),
       children.size());
   for (int i = 0; i < _children.size(); i++) {
     _children.get(i).compareTreeItem(children.get(i));
   }
 }