Example usage for org.apache.commons.jrcs.diff Revision ToString

List of usage examples for org.apache.commons.jrcs.diff Revision ToString

Introduction

In this page you can find the example usage for org.apache.commons.jrcs.diff Revision ToString.

Prototype

public ToString() 

Source Link

Usage

From source file:org.thdl.tib.input.TMW_RTF_TO_THDL_WYLIETest.java

private static void testActualAndExpected(String testName) {
    // Now ensure that the expected result and the actual result
    // coincide./*from   w w  w .  j av  a  2 s  . c o m*/
    int rc;
    String actualFile = "bin" + File.separator + "for-junit" + File.separator + "TMW_RTF_TO_THDL_WYLIE"
            + testName + ".out";
    String expectedFile = "source" + File.separator + "org" + File.separator + "thdl" + File.separator + "tib"
            + File.separator + "input" + File.separator + "TMW_RTF_TO_THDL_WYLIE" + testName + ".expected";
    assertTrue("The file the converter should've produced doesn't exist: " + actualFile,
            new File(actualFile).exists());
    assertTrue("The baseline file, the file containing the expected results, doesn't exist: " + expectedFile,
            new File(expectedFile).exists());
    Revision rev = JDiff.getDiff(expectedFile, actualFile);
    assertTrue("JDiff.getDiff returned null", null != rev);
    String lineSep = System.getProperty("line.separator");
    boolean foundExpectedDiff = false;
    String expectedDiff = ("3c3" + lineSep
            + "< {\\stylesheet{\\s1\\li0\\ri0\\fi0\\ql\\sbasedon2\\snext1 Body Text;}{\\s2 default;}}\n" + "---"
            + lineSep
            + "> {\\stylesheet{\\s2 default;}{\\s1\\li0\\ri0\\fi0\\ql\\sbasedon2\\snext1 Body Text;}}\n");
    if (0 != rev.size() && !(foundExpectedDiff = expectedDiff.equals(rev.toString()))) {
        System.out.println("Oops! the diff is this:");
        System.out.print(rev.toString());
        assertTrue("There was a difference between the actual and expected results", false);
    }
}