@Override
 public void processFinished(Parse row, boolean anyErrors) {
   if (!anyErrors) {
     mFixture.right(row);
   } else {
     mFixture.wrong(row);
   }
 }
Ejemplo n.º 2
0
 /* Added by Rick */
 protected Fixture getLinkedFixtureWithArgs(Parse tables) throws Throwable {
   Parse header = tables.at(0, 0, 0);
   Fixture fixture = loadFixture(header.text());
   fixture.counts = counts;
   fixture.summary = summary;
   fixture.getArgsForTable(tables);
   return fixture;
 }
Ejemplo n.º 3
0
 @Override
 public void doCell(Fixture fixture, Parse cell) throws Throwable {
   String text = ParseArg.parseCellValue(cell);
   if ("".equals(text)) {
     fixture.handleBlankCell(cell, adapter);
   }
   Object o = adapter.parse(text);
   adapter.set(o);
 }
Ejemplo n.º 4
0
  /* Added by Rick */
  private void interpretFollowingTables(Parse tables) {
    listener.tableFinished(tables);
    tables = tables.more;
    while (tables != null) {
      Parse heading = tables.at(0, 0, 0);

      if (forcedAbort) ignore(heading); // Semaphores: ignore on failed lock
      else if (heading != null) {
        try {
          Fixture fixture = getLinkedFixtureWithArgs(tables);
          fixture.doTable(tables);
        } catch (Throwable e) {
          exception(heading, e);
        }
      }
      listener.tableFinished(tables);
      tables = tables.more;
    }
  }
Ejemplo n.º 5
0
 public void doTables(Parse tables) {
   summary.put("run date", new Date());
   summary.put("run elapsed time", new RunTime());
   if (tables != null) {
     Parse heading = tables.at(0, 0, 0);
     if (heading != null) {
       try {
         Fixture fixture = getLinkedFixtureWithArgs(tables);
         fixture.listener = listener;
         fixture.interpretTables(tables);
       } catch (Throwable e) {
         exception(heading, e);
         interpretFollowingTables(tables);
       }
     }
   }
   listener.tablesFinished(counts);
   ClearSymbols();
   SemaphoreFixture.ClearSemaphores(); // Semaphores:  clear all at end
 }
Ejemplo n.º 6
0
 @SuppressWarnings("hiding")
 protected Method method(String test, int args) throws NoSuchMethodException {
   Method methods[] = actor.getClass().getMethods();
   Method result = null;
   for (int i = 0; i < methods.length; i++) {
     Method m = methods[i];
     if (m.getName().equals(test) && m.getParameterTypes().length == args) {
       if (result == null) {
         result = m;
       } else {
         throw new NoSuchMethodException("too many implementations");
       }
     }
   }
   if (result == null) {
     throw new NoSuchMethodException();
   }
   return result;
 }
Ejemplo n.º 7
0
  public void doCell(Fixture fixture, Parse cell) {
    ContentOfTableCell content = new ContentOfTableCell(cell.text());
    try {
      if (content.isSymbolSetter()) {
        Object actual = this.adapter.get();
        dbfit.util.SymbolUtil.setSymbol(content.text(), actual);
        cell.addToBody(Fixture.gray("= " + String.valueOf(actual)));
        // fixture.ignore(cell);
      } else if (content.isSymbolGetter()) {
        Object actual = this.adapter.get();
        Object expected = this.adapter.parse(content.text());
        cell.addToBody(Fixture.gray("= " + String.valueOf(expected)));

        if (adapter.equals(actual, expected)) {
          fixture.right(cell);
        } else {
          fixture.wrong(cell, String.valueOf(actual));
        }
      } else if (content.isExpectingInequality()) {
        // expect failing comparison
        Object actual = this.adapter.get();
        String expectedVal = content.getExpectedFailureValue();
        cell.addToBody(Fixture.gray("= " + String.valueOf(actual)));

        if (adapter.equals(actual, adapter.parse(expectedVal))) {
          fixture.wrong(cell);
        } else {
          fixture.right(cell);
        }
      } else {
        super.doCell(fixture, cell);
      }
    } catch (Throwable t) {
      fixture.exception(cell, t);
    }
  }
Ejemplo n.º 8
0
 public void testEscape() {
   assertEquals(" &nbsp; &nbsp; ", Fixture.escape("     "));
 }
Ejemplo n.º 9
0
 protected void executeAndAssert(Counts expected, String fitPage, Fixture fixture)
     throws ParseException {
   fixture.doTable(new Parse(fitPage));
   TestCaseHelper.assertCounts(expected, fixture.counts);
 }
Ejemplo n.º 10
0
 public Object parse(String s) throws Exception {
   Object obj;
   obj = isRegex ? s : fixture.parse(s, type);
   return obj;
 }