use of com.google.copybara.util.CommandRunner.CommandExecutor in project copybara by google.
the class CommandRunnerTest method testCommandWithCustomRunner.
@Test
public void testCommandWithCustomRunner() throws Exception {
Command command = bashCommand("");
CommandException e = assertThrows(CommandException.class, () -> runCommand(new CommandRunner(command).withCommandExecutor(new CommandExecutor() {
@Override
public TerminationStatus getCommandOutputWithStatus(Command cmd, byte[] input, KillableObserver cmdMonitor, OutputStream stdoutStream, OutputStream stderrStream) throws CommandException {
throw new CommandException(cmd, "OH NOES!");
}
})));
assertThat(e).hasMessageThat().contains("OH NOES!");
}
Aggregations