示例#1
0
  /**
   * Appends all rows and tables of the actual schema to the result. Only tables that are in the
   * expected schema will be appended.
   *
   * @param schema The expected schema, not null
   * @param actualSchema The actual schema, not null
   * @param result The result to append to, not null
   */
  protected void appendSchemaContent(Schema schema, Schema actualSchema, StringBuilder result) {
    for (Table table : schema.getTables()) {
      Table actualTable = actualSchema.getTable(table.getName());
      if (actualTable == null) {
        continue;
      }
      appendTableName(schema, actualTable, result);
      result.append("\n");

      if (actualTable.getRows().isEmpty()) {
        result.append("  <empty table>\n");
      } else {
        result.append("  ");
        appendColumnNames(actualTable.getRows().get(0), result);
        result.append("\n");
        for (Row row : actualTable.getRows()) {
          result.append("  ");
          appendRow(row, result);
          result.append("\n");
        }
      }
      result.append("\n");
    }
  }