@Test public void worksWithPath() throws Exception { Path f = new Which(context) .command("hello-world-test") .run(); assertThat(f, is(nullValue())); f = new Which(context) .command("hello-world-test") .path(getBinDirAsResource()) .run(); assertThat(f, is(not(nullValue()))); assertThat(Files.isRegularFile(f), is(true)); assertThat(Files.isExecutable(f), is(true)); assertThat(f.getFileName().toString(), either(is("hello-world-test")).or(is("hello-world-test.bat"))); }
public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; }
Which extends Action<Which.Result,Path> implements PathsMixin<Which> { public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; } }
Which extends Action<Which.Result,Path> implements PathsMixin<Which> { public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; } Which(Context context); }
Which extends Action<Which.Result,Path> implements PathsMixin<Which> { public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; } Which(Context context); Path getCommand(); Which command(String command); Which command(Path command); Which command(File command); @Override List<Path> getPaths(); static boolean isExecutableFile(Path file); static Path find(Context context, List<Path> paths, Path command); }
Which extends Action<Which.Result,Path> implements PathsMixin<Which> { public Which command(String command) { ObjectHelper.requireNonNull("command", "command cannot be null"); this.command = Paths.get(command); return this; } Which(Context context); Path getCommand(); Which command(String command); Which command(Path command); Which command(File command); @Override List<Path> getPaths(); static boolean isExecutableFile(Path file); static Path find(Context context, List<Path> paths, Path command);  }