Esempio n. 1
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");
    }
  }
Esempio n. 2
0
 /**
  * Appends the table differences of the given schema difference to the result
  *
  * @param schemaDifference The difference, not null
  * @param result The result to append to, not null
  */
 protected void appendTableDifferences(SchemaDifference schemaDifference, StringBuilder result) {
   for (TableDifference tableDifference : schemaDifference.getTableDifferences()) {
     Table table = tableDifference.getTable();
     if (table.isEmpty()) {
       result.append("\nExpected table to be empty but found rows for table ");
       appendTableName(schemaDifference.getSchema(), table, result);
       result.append("\n");
       continue;
     }
     result.append("\nFound differences for table ");
     appendTableName(schemaDifference.getSchema(), table, result);
     result.append(":\n");
     appendMissingRowDifferences(tableDifference, result);
     appendBestRowDifferences(tableDifference, result);
   }
 }
Esempio n. 3
0
 /**
  * Appends the missing rows 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 appendMissingRowDifferences(
     TableDifference tableDifference, StringBuilder result) {
   for (Row missingRow : tableDifference.getMissingRows()) {
     result.append("\n  Missing row:\n  ");
     appendColumnNames(missingRow, result);
     result.append("\n  ");
     appendRow(missingRow, result);
     result.append("\n");
   }
 }