package de.duehl.basics.start;

import de.duehl.basics.io.textfile.TextFileCompare;
import de.duehl.basics.text.Text;

public class TextFileCompareTest {

    public static void main(String[] args) {
        compare("u:/jerwent/regeln/cne_articles_of_partnership.txt",
                "u:/jerwent/regeln/cne_articles_of_partnership.txt");
        compare("u:/jerwent/regeln/cne_articles_of_partnership.txt",
                "u:/jerwent/regeln/cne_articles_of_partnership.txt_NICHT_DA");
        compare("u:/jerwent/regeln/cne_articles_of_partnership.txt_NICHT_DA",
                "u:/jerwent/regeln/cne_articles_of_partnership.txt");
        compare("u:/jerwent/regeln/cne_articles_of_partnership.txt_NICHT_DA",
                "u:/jerwent/regeln/cne_articles_of_partnership.txt_NICHT_DA");
        compare("u:/jerwent/regeln/cne_articles_of_partnership.txt",
                "u:/jerwent/regeln/cne_capital.txt");
    }

    private static void compare(String firstFilename, String secondFilename) {
        TextFileCompare compare = new TextFileCompare();
        boolean equal = compare.isContentEqual(firstFilename, secondFilename);
        System.out.println("Die Dateien\n\t" + firstFilename + "\nund\n\t"
                + secondFilename + "\nsind "
                + (equal ? "identisch" : "unterschiedlich") + ".");
        if (!equal) {
            System.out.println("Denn:\n" + compare.getDifferenceMessage());
        }
        Text.bar();
    }

}
