public BootstrapMetadata read() throws Exception {
        Path path = Paths.get(directoryPath);
        if (!Files.isDirectory(path)) {
            if (Files.exists(path)) {
                throw new RuntimeException("Path " + directoryPath + " exists, but is not " +
                        "a directory.");
            } else {
                throw new RuntimeException("No such directory as " + directoryPath);
            }
        }
        Path binaryBootstrapPath = Paths.get(directoryPath, BINARY_BOOTSTRAP_FILENAME);
        if (!Files.exists(binaryBootstrapPath)) {
            return readFromConfiguration();
        } else {
            return readFromBinaryFile(binaryBootstrapPath.toString());
        }
    }
@Test
    public void testMissingDirectory() {
        assertEquals("No such directory as ./non/existent/directory",
            assertThrows(RuntimeException.class, () ->
                new BootstrapDirectory("./non/existent/directory", Optional.empty()).read()).getMessage());
    }