public static void compare(final Path expectedFile, final Path actualFile, final boolean ignoreWhitespace,
                               final boolean xml) {
        // Make sure both files exist.
        if (!Files.isRegularFile(expectedFile)) {
            throw new RuntimeException(
                    "Expected file '" + FileUtil.getCanonicalPath(expectedFile) + "' does not exist");
        }
        if (!Files.isRegularFile(actualFile)) {
            throw new RuntimeException("Actual file '" + FileUtil.getCanonicalPath(actualFile) + "' does not exist");
        }

        Reader reader1 = null;
        Reader reader2 = null;
        try {
            reader1 = new BufferedReader(new InputStreamReader(Files.newInputStream(expectedFile),
                    StreamUtil.DEFAULT_CHARSET));
            reader2 = new BufferedReader(new InputStreamReader(Files.newInputStream(actualFile),
                    StreamUtil.DEFAULT_CHARSET));

            if (!doCompareReaders(reader1, reader2, ignoreWhitespace, xml)) {
                throw new RuntimeException(LogUtil.message(
                        "Files are not the same: \n" +
                                "{}\n" +
                                "{}\n\n" +
                                "vimdiff {} {}\n" +
                                "If you are satisfied the differences are valid then you can do\n" + "cp {} {}",
                        FileUtil.getCanonicalPath(expectedFile),
                        FileUtil.getCanonicalPath(actualFile),
                        FileUtil.getCanonicalPath(expectedFile),
                        FileUtil.getCanonicalPath(actualFile),
                        FileUtil.getCanonicalPath(actualFile),
                        FileUtil.getCanonicalPath(expectedFile)
                ));
            }

        } catch (final IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            if (reader1 != null) {
                try {
                    reader1.close();
                } catch (final IOException e) {
                    // Swallow as trying to ensure it is closed.
                }
            }
            if (reader2 != null) {
                try {
                    reader2.close();
                } catch (final IOException e) {
                    // Swallow as trying to ensure it is closed.
                }
            }
        }
    }
Generate a unified diff of the two files using the specified number of lines of context.
The diff output is sent to system out in coloured form.

@return True if the files are the same
stroom-test-common/src/main/java/stroom/test/common/ComparisonHelper.java