use of com.facebook.buck.util.FakeProcess in project buck by facebook.
the class ShellStepTest method testStdinGetsToProcessWhenPresent.
@Test
public void testStdinGetsToProcessWhenPresent() throws Exception {
final Optional<String> stdin = Optional.of("hello world!");
ShellStep command = createCommand(ImmutableMap.of(), ImmutableList.of("cat", "-"), null, /*shouldPrintStdErr*/
true, /*shouldPrintStdOut*/
true, stdin);
ProcessExecutorParams params = createParams();
FakeProcess process = new FakeProcess(EXIT_SUCCESS, OUTPUT_MSG, ERROR_MSG);
TestConsole console = new TestConsole(Verbosity.ALL);
ExecutionContext context = createContext(ImmutableMap.of(params, process), console);
command.launchAndInteractWithProcess(context, params);
assertEquals(stdin.get(), process.getOutput());
}
Aggregations