예제 #1
0
 /**
  * Appends the column names of the given row to the result
  *
  * @param row The row, not null
  * @param result The result to append to, not null
  */
 protected void appendColumnNames(Row row, StringBuilder result) {
   for (Column column : row.getColumns()) {
     result.append(column.getName());
     result.append(", ");
   }
   result.setLength(result.length() - 2);
 }
예제 #2
0
 /**
  * Appends the values of the given row to the result
  *
  * @param row The row, not null
  * @param result The result to append to, not null
  */
 protected void appendRow(Row row, StringBuilder result) {
   for (Column column : row.getColumns()) {
     result.append(objectFormatter.format(column.getValue()));
     result.append(", ");
   }
   result.setLength(result.length() - 2);
 }
예제 #3
0
  /**
   * Appends the best matching row differences of the given table difference to the result
   *
   * @param tableDifference The difference, not null
   * @param result The result to append to, not null
   */
  protected void appendBestRowDifferences(TableDifference tableDifference, StringBuilder result) {
    for (RowDifference rowDifference : tableDifference.getBestRowDifferences()) {
      result.append("\n  Different row: \n  ");
      appendColumnNames(rowDifference.getRow(), result);
      result.append("\n  ");
      appendRow(rowDifference.getRow(), result);

      result.append("\n\n  Best matching differences:  ");
      for (Column column : rowDifference.getMissingColumns()) {
        result.append("\n  Missing column ");
        result.append(column.getName());
      }
      for (ColumnDifference columnDifference : rowDifference.getColumnDifferences()) {
        result.append("\n  ");
        result.append(columnDifference.getColumn().getName());
        result.append(": ");
        result.append(objectFormatter.format(columnDifference.getColumn().getValue()));
        result.append(" <-> ");
        Column actualColumn = columnDifference.getActualColumn();
        result.append(
            objectFormatter.format(actualColumn == null ? null : actualColumn.getValue()));
      }
      result.append("\n");
    }
  }