Skip to content

Commit

Permalink
Wait for the process output to be captured in the CommandRunner unit …
Browse files Browse the repository at this point in the history
…test `runAsyncWithOutput`
  • Loading branch information
besidev committed May 20, 2024
1 parent 864fa66 commit 128867b
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
Expand Down Expand Up @@ -88,6 +89,7 @@ public void runAsyncWithOutput() throws IOException, InterruptedException {
Process process = commandRunner.runAsync("async-dir-list");
int result = process.waitFor();
assertThat(result).isEqualTo(0); // Successful execution
Thread.sleep(TimeUnit.SECONDS.toMillis(3)); // Wait for the process output to be captured
assertThat(commandRunner.getResponses().size()).isEqualTo(1);
assertThat(commandRunner.getLastResponse()).isEqualTo("build.gradle");
}
Expand Down

0 comments on commit 128867b

Please sign in to comment.