public void check() throws Throwable { Method checkMethod = tryFindMethodWithArgs(0); Class<?> returnType = checkMethod.getReturnType(); Parse checkValueCell = cells.more.more; if (checkValueCell == null) throw new FitFailureException("You must specify a value to check."); check(checkValueCell, getTypeAdapter(checkMethod, returnType)); }
@Override public void doCells(Parse cells) { this.cells = cells; String methodName = cells.text(); try { getClass().getMethod(methodName).invoke(this); } catch (Exception e) { exception(cells, e); } }
protected Method tryFindMethodWithArgs(int args) throws NoSuchMethodException { Parse methodCell = cells.more; if (isNullOrBlank(methodCell)) throw new FitFailureException("You must specify a method."); String methodName = camel(methodCell.text()); if (actor == null) throw new FitFailureException("You must start a fixture using the 'start' keyword."); Method theMethod = findMethodWithArgs(methodName, args); if (theMethod == null) { throw new NoSuchMethodFitFailureException(methodName); } return theMethod; }
public void enter() throws Exception { Parse argumentCell = cells.more.more; if (argumentCell == null) throw new FitFailureException("You must specify an argument."); Method enterMethod = tryFindMethodWithArgs(1); Class<?> parameterType = enterMethod.getParameterTypes()[0]; String argument = argumentCell.text(); enterMethod.invoke(actor, adaptArgumentToType(parameterType, argument)); }
public void start() throws Throwable { Parse fixture = cells.more; if (isNullOrBlank(fixture)) throw new FitFailureException("You must specify a fixture to start."); actor = loadFixture(fixture.text()); }
public void doCells(Parse cells) { Date start = time(); super.doCells(cells); long split = time().getTime() - start.getTime(); cells.last().more = td(format.format(start)); cells.last().more = td(split<1000 ? " " : Double.toString((split)/1000.0)); }
@Override public void doTable(Parse table) { super.doTable(table); table.parts.parts.last().more = td("time"); table.parts.parts.last().more = td("split"); }
@Override public void check(CellWrapper<Parse> valueCell, RestDataTypeAdapter adapter) { valueCell.body(Tools.toHtml(valueCell.body())); fixture.check(valueCell.getWrapped(), adapter); }
protected Method tryFindMethodWithArgs(int args) throws NoSuchMethodException { Parse methodCell = cells.more; if (isNullOrBlank(methodCell)) throw new FitFailureException("You must specify a method."); String methodName = camel(methodCell.text()); if (actor == null) throw new FitFailureException("You must start a fixture using the 'start' keyword."); Method theMethod = findMethodWithArgs(methodName, args); if (theMethod == null) { throw new NoSuchMethodFitFailureException(methodName); } return theMethod; }
public void enter() throws Exception { Parse argumentCell = cells.more.more; if (argumentCell == null) throw new FitFailureException("You must specify an argument."); Method enterMethod = tryFindMethodWithArgs(1); Class<?> parameterType = enterMethod.getParameterTypes()[0]; String argument = argumentCell.text(); enterMethod.invoke(actor, adaptArgumentToType(parameterType, argument)); }
public void start() throws Throwable { Parse fixture = cells.more; if (isNullOrBlank(fixture)) throw new FitFailureException("You must specify a fixture to start."); actor = loadFixture(fixture.text()); }
@Override public void doCells(Parse cells) { Date start = time(); super.doCells(cells); long split = time().getTime() - start.getTime(); cells.last().more = td(makeDateFormat().format(start)); cells.last().more = td(split < 1000 ? " " : Double.toString((split) / 1000.0)); }
@Override public void doTable(Parse table) { super.doTable(table); table.parts.parts.last().more = td("time"); table.parts.parts.last().more = td("split"); }
public void check() throws Throwable { Method checkMethod = tryFindMethodWithArgs(0); Class<?> returnType = checkMethod.getReturnType(); Parse checkValueCell = cells.more.more; if (checkValueCell == null) throw new FitFailureException("You must specify a value to check."); check(checkValueCell, getTypeAdapter(checkMethod, returnType)); }
public void doCells(Parse cells) { this.cells = cells; try { Method action = getClass().getMethod(cells.text()); action.invoke(this); } catch (Exception e) { exception(cells, e); } }
@Override public void doCells(Parse cells) { Date start = time(); super.doCells(cells); long split = time().getTime() - start.getTime(); cells.last().more = td(makeDateFormat().format(start)); cells.last().more = td(split < 1000 ? " " : Double.toString((split) / 1000.0)); }
public void doTable(Parse table) { super.doTable(table); table.parts.parts.last().more = td("time"); table.parts.parts.last().more = td("split"); }
@Override public void exception(CellWrapper<Parse> cell, Throwable exception) { Parse wrapped = cell.getWrapped(); fixture.exception(wrapped, exception); }