Ejemplo n.º 1
0
 /**
  * Appends the missing tables 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 appendMissingTableDifferences(
     SchemaDifference schemaDifference, StringBuilder result) {
   for (Table missingTable : schemaDifference.getMissingTables()) {
     result.append("\nFound missing table ");
     result.append(schemaDifference.getSchema().getName());
     result.append(".");
     result.append(missingTable.getName());
   }
 }
Ejemplo n.º 2
0
  /**
   * Formats the assertion failed message for the given difference.
   *
   * @param schemaDifference The difference, not null
   * @return The message, not null
   */
  protected String generateErrorMessage(SchemaDifference schemaDifference) {
    StringBuilder result =
        new StringBuilder(
            "Assertion failed. Differences found between the expected data set and actual database content.");

    String schemaName = schemaDifference.getSchema().getName();
    appendMissingTableDifferences(schemaDifference, result);
    appendTableDifferences(schemaDifference, result);
    result.append("\n\nActual database content:\n\n");
    appendSchemaContent(schemaDifference.getSchema(), schemaDifference.getActualSchema(), result);
    return result.toString();
  }
Ejemplo n.º 3
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);
   }
 }