public ImmutableList<String> includes() { return Globs.glob(join(fileRoot, include)); }
private Runner createDynamicConfigurationRunner(final StartArgs startArgs) { String pathname = startArgs.getConfigurationFile().get(); ImmutableList<String> glob = glob(pathname); Iterable<File> files = from(glob).transform(filenameToFile()); final FileRunner fileRunner = createConfigurationFileRunner(files, startArgs); Watcher watcher = factory.createConfigurationWatcher(files, fileRunner); return new WatcherRunner(fileRunner, watcher); } }
@Test(expected = MocoException.class) public void should_throw_exception_for_unknown_root() { Globs.glob("unknown/src/test/resources/details/*.json"); }
@Test public void should_glob_files() { ImmutableList<String> glob = Globs.glob("*.json"); assertThat(glob.isEmpty(), is(true)); } }
@Test public void should_glob_direct_files() { ImmutableList<String> files = Globs.glob("src/test/resources/details/foo.json"); assertThat(files.contains("src/test/resources/details/foo.json"), is(true)); }
@Test public void should_glob_absolute_files() throws IOException { File file = folder.newFile(); String path = file.getAbsolutePath(); ImmutableList<String> files = Globs.glob(path); assertThat(files.contains(path), is(true)); }
@Test public void should_glob_relative_files() { ImmutableList<String> files = Globs.glob("src/test/resources/details/*.json"); assertThat(files.contains("src/test/resources/details/foo.json"), is(true)); assertThat(files.contains("src/test/resources/details/bar.json"), is(true)); }
@Test public void should_glob_absolute_files_with_glob() throws IOException { File file = folder.newFile("glob.json"); String glob = Files.join(folder.getRoot().getAbsolutePath(), "*.json"); ImmutableList<String> files = Globs.glob(glob); assertThat(files.contains(file.getAbsolutePath()), is(true)); }
public ImmutableList<String> includes() { return Globs.glob(join(fileRoot, include)); }
private Runner createDynamicConfigurationRunner(final StartArgs startArgs) { String pathname = startArgs.getConfigurationFile().get(); ImmutableList<String> glob = glob(pathname); Iterable<File> files = from(glob).transform(filenameToFile()); final FileRunner fileRunner = createConfigurationFileRunner(files, startArgs); Watcher watcher = factory.createConfigurationWatcher(files, fileRunner); return new WatcherRunner(fileRunner, watcher); } }