/*
  This file is licensed to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

package org.xmlunit.diff;

import javax.xml.transform.Source;

/**
 * The Diff-Object is the result of two comparisons.
 * @see org.xmlunit.builder.DiffBuilder
 */
public class Diff {

    private static final ComparisonFormatter DEFAULT_FORMATTER =
        new DefaultComparisonFormatter();

    private final Iterable<Difference> differences;

    private final Source controlSource;

    private final Source testSource;

    private final ComparisonFormatter formatter;

    public Diff(Source controlSource, Source testSource, Iterable<Difference> differences) {
        this(controlSource, testSource, DEFAULT_FORMATTER, differences);
    }

    public Diff(Source controlSource, Source testSource,
                ComparisonFormatter formatter, Iterable<Difference> differences) {
        this.controlSource = controlSource;
        this.testSource = testSource;
        this.formatter = formatter;
        this.differences = differences;
        for (Difference d : differences) {
            d.setComparisonFormatter(formatter);
        }
    }

    /**
     * @return true if there was at least one difference.
     */
    public boolean hasDifferences() {
        return differences.iterator().hasNext();
    }

    /**
     * @return all differences found before the comparison process stopped.
     */
    public Iterable<Difference> getDifferences() {
        return differences;
    }


    public Source getControlSource() {
        return controlSource;
    }


    public Source getTestSource() {
        return testSource;
    }

    @Override
    public String toString() {
        return toString(formatter);
    }

    public String toString(ComparisonFormatter formatter) {
        if (!hasDifferences()) {
            return "[identical]";
        }
        return getDifferences().iterator().next().getComparison().toString(formatter);
    }

}

@@ -620,16 +620,43 @@
 .Source;
+%0Aimport java.util.Iterator;
 %0A%0A/**%0A *
@@ -1660,574 +1660,2474 @@
   * 
-@return true if there was at least one difference.%0A     */%0A    public boolean hasDifferences() %7B%0A        return differences.iterator().hasNext();%0A    %7D%0A%0A    /**%0A     * @return all differences found before the comparison process stopped.%0A     */%0A    public Iterable%3CDifference%3E getDifferences() %7B%0A        return differences;%0A    %7D%0A%0A%0A    public Source getControlSource() %7B%0A        return controlSource;%0A    %7D%0A%0A%0A    public Source getTestSource() %7B%0A        return testSource;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return toString(formatter);%0A    %7D%0A
+Returns a string representation of this diff%0A     * using internal %7B@link ComparisonFormatter%7D or%0A     * %7B@link DefaultComparisonFormatter%7D if formatter wasn't set.%0A     * Each comparison result separated by the end of the line.%0A     * @return a string representation of this diff%0A     */%0A    public String fullDescription() %7B%0A        return fullDescription(formatter);%0A    %7D%0A%0A    /**%0A     * Returns a string representation of this diff%0A     * using the given %7B@link ComparisonFormatter%7D%0A     * @param formatter the %7B@link ComparisonFormatter%7D to use%0A     * @return a string representation of this diff%0A     */%0A    public String fullDescription(ComparisonFormatter formatter) %7B%0A        if (!hasDifferences()) %7B%0A            return %22%5Bidentical%5D%22;%0A        %7D%0A        Iterator%3CDifference%3E diffIterator = getDifferences().iterator();%0A        StringBuilder result = new StringBuilder()%0A            .append(diffIterator.next().getComparison().toString(formatter));%0A        String lineSeparator = System.lineSeparator();%0A        while (diffIterator.hasNext()) %7B%0A            result.append(lineSeparator)%0A                .append(diffIterator.next().getComparison().toString(formatter));%0A        %7D%0A        return result.toString();%0A    %7D%0A%0A    /**%0A     * @return true if there was at least one difference.%0A     */%0A    public boolean hasDifferences() %7B%0A        return differences.iterator().hasNext();%0A    %7D%0A%0A    /**%0A     * @return all differences found before the comparison process stopped.%0A     */%0A    public Iterable%3CDifference%3E getDifferences() %7B%0A        return differences;%0A    %7D%0A%0A%0A    public Source getControlSource() %7B%0A        return controlSource;%0A    %7D%0A%0A%0A    public Source getTestSource() %7B%0A        return testSource;%0A    %7D%0A%0A    /**%0A     * Returns a string representation of first found difference in this diff%0A     * using internal %7B@link ComparisonFormatter%7D or%0A     * %7B@link DefaultComparisonFormatter%7D if formatter wasn't set%0A     * @return a string representation of first found difference in this diff%0A     * @see #fullDescription()%0A     */%0A    @Override%0A    public String toString() %7B%0A        return toString(formatter);%0A    %7D%0A%0A    /**%0A     * Returns a string representation of first found difference in this diff%0A     * using the given %7B@link ComparisonFormatter%7D%0A     * @param formatter the %7B@link ComparisonFormatter%7D to use%0A     * @return a string representation of first found difference in this diff%0A     * @see #fullDescription(ComparisonFormatter)%0A     */
 %0A   

Add method for getting full description from diff