public static void compareDirs(final Path in, final Path out) {
        final List<Path> inFiles = list(in);
        final List<Path> outFiles = list(out);

        assertThat(outFiles.size()).as(
                "Dir " + FileUtil.getCanonicalPath(in) + " does not contain the same number of files as "
                        + FileUtil.getCanonicalPath(out)).isEqualTo(inFiles.size());

        for (final Path inFile : inFiles) {
            Path outFile = null;

            // Get corresponding output file.
            for (final Path tmp : outFiles) {
                if (tmp.getFileName().toString().equals(inFile.getFileName().toString())) {
                    outFile = tmp;
                    break;
                }
            }

            // Make sure we found the file.
            assertThat(outFile)
                    .as("Output file not found for: " + FileUtil.getCanonicalPath(inFile)
                            + " in directory \"" + FileUtil.getCanonicalPath(out) + "\"")
                    .isNotNull();

            LOGGER.debug("Comparing \"" + FileUtil.getCanonicalPath(inFile) + "\" and \"" +
                    FileUtil.getCanonicalPath(outFile) + "\"");

            if (Files.isDirectory(inFile)) {
                // Make sure files are the same type.
                assertThat(Files.isDirectory(outFile))
                        .as("Output file is not a directory for: " + FileUtil.getCanonicalPath(inFile))
                        .isTrue();

                // Recurse.
                compareDirs(inFile, outFile);

            } else if (Files.isRegularFile(inFile)) {
                compareFiles(inFile, outFile);
            }
        }
    }
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