public Set<String> filesInDirectory(File dir) throws IOException {

        Set<String> fileList = new HashSet<>();
        Path dirPath = Paths.get(dir.getPath());
        if (!Files.exists(dirPath)) {
            return Collections.emptySet();
        }

        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dirPath)) {
            for (Path path : stream) {
                if (!Files.isDirectory(path)) {
                    fileList.add(path.toString());
                }
            }
        }

        return fileList;
    }
@Test
    public void testFilesInDirectory() throws IOException {

        String content = "x y z";
        Path path = Paths.get(temporaryDirectory.getPath(), FOOBAR);
        File letters = path.toFile();
        Files.write(letters.toPath(), Collections.singletonList(content));

        path = Paths.get(temporaryDirectory.getPath(), FOOBAR_HTML);
        File letters2 = path.toFile();
        Files.write(letters2.toPath(), Collections.singletonList(content));

        Set<String> result = fileUtil.filesInDirectory(temporaryDirectory);

        assertAll(
                () -> assertEquals(2, result.size()),
                () -> assertTrue(result.contains(letters.getPath())),
                () -> assertTrue(result.contains(letters2.getPath())));
    }