public Optional<File> getFile(FileReference reference) {
        ensureRootExist();
        File dir = new File(getPath(reference));
        if (!dir.exists()) {
            // This is common when config server has not yet received the file from one the server the app was deployed on
            log.log(FINE, "File reference '" + reference.value() + "' ('" + dir.getAbsolutePath() + "') does not exist.");
            return Optional.empty();
        }
        if (!dir.isDirectory()) {
            log.log(INFO, "File reference '" + reference.value() + "' ('" + dir.getAbsolutePath() + ")' is not a directory.");
            return Optional.empty();
        }
        File[] files = dir.listFiles(new Filter());
        if (files == null || files.length == 0) {
            log.log(INFO, "File reference '" + reference.value() + "' ('" + dir.getAbsolutePath() + "') does not contain any files");
            return Optional.empty();
        }
        return Optional.of(files[0]);
    }
@Test
    public void requireThatFileReferenceWithFilesWorks() throws IOException {
        FileReference foo = createFile("foo");
        FileReference bar = createFile("bar");

        assertTrue(fileDirectory.getFile(foo).get().exists());
        assertEquals("ea315b7acac56246", foo.value());
        assertTrue(fileDirectory.getFile(bar).get().exists());
        assertEquals("2b8e97f15c854e1d", bar.value());
    }