private void writeRows(List<? extends Row> rows) { if ( rows != null && rows.size() > 0 ){ for ( Row row : rows ){ out.append("|"); for ( String c : row.getCells() ){ out.append(c).append("|"); } out.append("\n"); } } }
for (Comment comment : row.getComments()) { buffer.append(" "); buffer.append(comment.getValue()); rowHeight++; switch (row.getDiffType()) { case NONE: buffer.append(" | "); String cellText = escapeCell(getCellSafely(row.getCells(), colIndex)); String status = null; switch (row.getDiffType()) { case NONE: status = cellResults.size() < colIndex ? cellResults.get(colIndex).getStatus() : "skipped";
public void table(List<? extends Row> rows) { prepareTable(rows); if (!executing) { for (Row row : rows) { row(row.createResults("skipped")); nextRow(); } } }
private void prepareTable(List<? extends Row> rows) { this.rows = rows; // find the largest row int columnCount = 0; for (Row row : rows) { if (columnCount < row.getCells().size()) { columnCount = row.getCells().size(); } } cellLengths = new int[rows.size()][columnCount]; maxLengths = new int[columnCount]; for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) { Row row = rows.get(rowIndex); final List<String> cells = row.getCells(); for (int colIndex = 0; colIndex < columnCount; colIndex++) { final String cell = getCellSafely(cells, colIndex); final int length = escapeCell(cell).length(); cellLengths[rowIndex][colIndex] = length; maxLengths[colIndex] = Math.max(maxLengths[colIndex], length); } } rowIndex = 0; }
/** * Generate multiline argument (DataTable or DocString) representation * * @param step - Cucumber step object * @return - transformed multiline argument (or empty string if there is * none) */ public static String buildMultilineArgument(Step step) { List<DataTableRow> table = step.getRows(); DocString ds = step.getDocString(); StringBuilder marg = new StringBuilder(); if (table != null) { marg.append("\r\n"); for (Row row : table) { marg.append(TABLE_SEPARATOR); for (String cell : row.getCells()) { marg.append(" ").append(cell).append(" ").append(TABLE_SEPARATOR); } marg.append("\r\n"); } } if (ds != null) { marg.append(DOCSTRING_DECORATOR).append(ds.getValue()).append(DOCSTRING_DECORATOR); } return marg.toString(); } }