public static void assertPathExists()

in libs/test-utils/src/main/java/co/elastic/gradle/AssertFiles.java [32:49]


    public static void assertPathExists(Path path) {
        if (!Files.exists(path)) {
            String additional = "";
            if (Files.exists(path.getParent())) {
                try (Stream<Path>stream = Files.list(path.getParent())) {
                    additional = "\n parent directory contains:\n    " +
                                 stream
                                         .map(Path::toString)
                                         .collect(Collectors.joining("\n    "));
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            } else {
                additional = "\nParent path doesn't exist either";
            }
            Assertions.fail("Expected `" + path + "` to exist but it did not." + additional);
        }
    }