Package fit

Examples of fit.Parse


    assertEquals("b", simpleTable.parts.more.more.parts.body);
  }

  @Test
  public void testBadInput() throws ParseException {
    Parse table = new Parse("<table>" +
      "<tr><td>Fixture</td></tr>" +
      "<tr><td>a</td><td>b</td></tr>" +
      "<tr><td>1</td><td>2</td></tr>" +
      "</table>");
    fixture.doTable(table);
    assertTrue(table.at(0, 3, 1).body.contains(ERROR_MESSAGE));
  }
View Full Code Here


    assertTrue(table.at(0, 3, 1).body.contains(ERROR_MESSAGE));
  }

  @Test
  public void testMessageFormat() throws ParseException {
    Parse table = new Parse("<table>" +
      "<tr><td>Fixture</td></tr>" +
      "<tr><td>a</td><td>b</td></tr>" +
      "<tr><td>1</td><td>2</td></tr>" +
      "</table>");
    fixture.doTable(table);
    assertTrue(table.at(0, 3, 1).tag.contains("colspan=\"3\""));
  }
View Full Code Here

  public void doTable(Parse table) {
    if (table.parts.more == null) {
      return;
    }
    validateDecoratorInput(table);
    Parse actualHeader = table.parts.more.parts;
    String encapsulatedFixtureName = actualHeader.text();
    super.summary.put(ENCAPSULATED_FIXTURE_NAME, encapsulatedFixtureName);
    Fixture fixture = loadFixture(actualHeader, encapsulatedFixtureName);
    if (fixture != null) {
      execute(fixture, table);
      super.summary.putAll(fixture.summary);
View Full Code Here

    fixture.doTable(table);
  }

  private void execute(Fixture fixture, Parse table) {
    Table t = new Table(table);
    Parse firstRow = t.stripFirstRow();
    run(fixture, table);
    t.insertAsFirstRow(firstRow);
    updateColumnsBasedOnResults(table);
  }
View Full Code Here

    }
  }

  void setAlternativeArgs(Parse table) {
    List<String> argumentList = new ArrayList<String>();
    Parse columns = table.parts.parts;
    int size = columns.size();
    for (int i = 0; i < size / 2; ++i) {
      String columnValue = columns.at(i * 2 + 1).text();
      columnValue = escapeExpectedAndActualString(columnValue);
      argumentList.add(columnValue);
    }
    args = (String[]) argumentList.toArray(new String[argumentList.size()]);
  }
View Full Code Here

      reportError(row, e);
    }
  }

  protected Parse appendCell(Parse row, String text) {
    Parse lastCell = new Parse("td", text, null, null);
    row.parts.last().more = lastCell;
    return lastCell;
  }
View Full Code Here

    row.parts.last().more = lastCell;
    return lastCell;
  }

  public void reportError(Parse row, Exception e) {
    Parse errorCell = makeMessageCell(e);
    insertRowAfter(row, new Parse("tr", null, errorCell, null));
  }
View Full Code Here

    Parse errorCell = makeMessageCell(e);
    insertRowAfter(row, new Parse("tr", null, errorCell, null));
  }

  public Parse makeMessageCell(Exception e) {
    Parse errorCell = new Parse("td", "", null, null);
    final StringWriter buffer = new StringWriter();

    e.printStackTrace(new PrintWriter(buffer));
    errorCell.addToTag(" colspan=\"" + (columnBindings.length + 1) + "\"");
    errorCell.addToBody("<i>" + ERROR_INDICATOR + e.getMessage() + "</i>");
    errorCell.addToBody("<pre>" + (buffer.toString()) + "</pre>");
    wrong(errorCell);

    return errorCell;
  }
View Full Code Here

    return errorCell;
  }

  public void insertRowAfter(Parse currentRow, Parse rowToAdd) {
    Parse nextRow = currentRow.more;
    currentRow.more = rowToAdd;
    rowToAdd.more = nextRow;
  }
View Full Code Here

  }

  @Test
  public void testConstructorShouldBuildTableFromParseObject() throws Exception {
    String expectedTableContents = "<tr><td>fit.decorator.MaxTime</td><td>10</td></tr>";
    Parse parse = new Parse(expectedTableContents, new String[]
      {"tr", "td"});
    table = new Table(parse);
    assertTable(expectedTableContents);
  }
View Full Code Here

TOP

Related Classes of fit.Parse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.