public static byte[] readTable(Parse table) throws Exception { ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); OutputStreamWriter streamWriter = new OutputStreamWriter(byteBuffer, FileUtil.CHARENCODING); PrintWriter writer = new PrintWriter(streamWriter); Parse more = table.more; table.more = null; if (table.trailer == null) table.trailer = ""; table.print(writer); table.more = more; writer.close(); return byteBuffer.toByteArray(); }
public static byte[] readTable(Parse table) throws Exception { ByteArrayOutputStream byteBuffer = new ByteArrayOutputStream(); OutputStreamWriter streamWriter = new OutputStreamWriter(byteBuffer, FileUtil.CHARENCODING); PrintWriter writer = new PrintWriter(streamWriter); Parse more = table.more; table.more = null; if (table.trailer == null) table.trailer = ""; table.print(writer); table.more = more; writer.close(); return byteBuffer.toByteArray(); }
/** * Recursively prints the content of this tree to the given stream. * * @param out output stream */ public void print(PrintWriter out) { out.print(leader); out.print(tag); if (parts != null) { parts.print(out); } else { out.print(body); } out.print(end); if (more != null) { more.print(out); } else { out.print(trailer); } }
/** * TODO unclear, from Fit 1.1+. * * @return */ @Deprecated public String footnote() { if (footnoteFiles >= 25) { return "[-]"; } else { try { int thisFootnote = ++footnoteFiles; String html = "footnotes/" + thisFootnote + ".html"; File file = new File("Reports/" + html); file.delete(); PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); print(output); output.close(); return "<a href=/fit/Release/Reports/" + html + "> [" + thisFootnote + "]</a>"; } catch (IOException e) { return "[!]"; } } } }
@Override public void describeMismatchSafely(Parse item, Description mismatchDescription) { StringWriter sw = new StringWriter(); item.print(new PrintWriter(sw)); mismatchDescription .appendText("was actualCount=" + actualCount + ":\n---\n") .appendText(sw.toString()).appendText("\n---\n"); }
public void process() { try { tables = new Parse(input); fixture.doTables(tables); } catch (Exception e) { exception(e); } tables.print(output); }
@Override public void process() { String[] tags = {"wiki", "table", "tr", "td"}; try { tables = new Parse(input, tags); // look for wiki tag enclosing tables fixture.doTables(tables.parts); // only do tables within that tag } catch (Exception e) { exception(e); } tables.print(output); } }
public void process() { try { tables = new Parse(input); fixture.doTables(tables); } catch (Exception e) { exception(e); } tables.print(output); }
@Override public void process() { String[] tags = {"wiki", "table", "tr", "td"}; try { tables = new Parse(input, tags); // look for wiki tag enclosing tables fixture.doTables(tables.parts); // only do tables within that tag } catch (Exception e) { exception(e); } tables.print(output); } }
private boolean run(Reader reader, Writer writer) throws IOException, ParseException { String input = read(reader); Parse tables = new Parse(input); fixture = new Fixture(); fixture.doTables(tables); PrintWriter output = new PrintWriter(writer); tables.print(output); output.flush(); return passed(fixture); }
public void process() { try { if (input.indexOf("<wiki>") >= 0) { tables = new Parse(input, new String[] { "wiki", "table", "tr", "td" }); fixture.doTables(tables.parts); } else { tables = new Parse(input, new String[] { "table", "tr", "td" }); fixture.doTables(tables); } } catch (Exception e) { exception(e); } tables.print(output); }
private boolean run(Reader reader, Writer writer) throws IOException, ParseException { listener.beforeTest(testPath); String input = read(reader); Parse tables = new Parse(input); fixture = new Fixture(); fixture.doTables(tables); PrintWriter output = new PrintWriter(writer); tables.print(output); output.flush(); boolean passed = passed(fixture); result = new TestResult(); result.setPath(testPath); result.setPassed(passed); result.setRight(fixture.getCounts().right); result.setWrong(fixture.getCounts().wrong); result.setIgnored(fixture.getCounts().ignores); result.setExceptions(fixture.getCounts().exceptions); listener.afterTest(result); return passed; }