LiveRepositoryUpdate implements Comparable<LiveRepositoryUpdate> { public void start() throws IOException { repository.walk(new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { refresh(repository, path.toFile().toPath()); return CONTINUE; } }); repository.watch(path -> refresh(repository, path)); } LiveRepositoryUpdate(Repository<A> repository,
                                AbstractLoader<A> loader,
                                List<Migration<A>> migrationList); void start(); void migrate(); @Override int compareTo(LiveRepositoryUpdate o);  }
@Test public void should_be_refresh_repository_index_json_on_start() throws Exception { LiveRepositoryUpdate<Page> liveRepositoryUpdate = new LiveRepositoryUpdate<>(repository, loader, EMPTY_LIST); createPage("1.7.25"); liveRepositoryUpdate.start(); verify(persister).updateMetadata(any(Path.class), any(Page.class)); verify(persister).saveInIndex(any(Path.class), any(Page.class)); }