private void handleErrorInCell(TypeAdapter a, Parse cell) { try { Object result = a.invoke(); wrong(cell, a.toString(result)); } catch (IllegalAccessException e) { exception(cell, e); } catch (Exception e) { right(cell); } }
public void doCells(Parse cells) { for (int i = 0; cells != null; i++) { try { doCell(cells, i); } catch (Exception e) { exception(cells, e); } cells = cells.more; } }
/* Added by Rick to allow a dispatch into DoFixture */ protected void interpretTables(Parse tables) { try { // Don't create the first fixture again, because creation may do something important. getArgsForTable(tables); // get them again for the new fixture object doTable(tables); } catch (Exception ex) { exception(tables.at(0, 0, 0), ex); listener.tableFinished(tables); return; } interpretFollowingTables(tables); }
/* 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; } }
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 }
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); } }