void (Path expected, Path actual) { if (Files.isDirectory(expected)) { try { Files.walkFileTree(expected, new SimpleFileVisitor<>() { @Override public FileVisitResult visitFile(Path expectedFile, BasicFileAttributes attrs) { Path actualFile = actual.resolve(expected.relativize(expectedFile)); assertThat(actualFile).usingCharset(StandardCharsets.UTF_8).hasSameTextualContentAs(expectedFile, StandardCharsets.UTF_8); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { throw new UncheckedIOException(e); } } else { assertThat(actual).usingCharset(StandardCharsets.UTF_8).hasSameTextualContentAs(expected, StandardCharsets.UTF_8); } }