use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class FileConsoleTest method testFlushingFrequencyDeactivated.
/**
* We only flush when the file is closed
*/
@Test
public void testFlushingFrequencyDeactivated() throws Exception {
TestingConsole delegate = new TestingConsole();
try (FileConsole fileConsole = new FileConsole(delegate, file, Duration.ZERO)) {
fileConsole.startupMessage("v1");
fileConsole.info("This is info");
fileConsole.warn("This is warning");
assertThat(Files.readAllLines(file)).isEmpty();
Thread.sleep(3000);
fileConsole.error("This is error");
fileConsole.verbose("This is verbose");
List<String> lines = Files.readAllLines(file);
assertThat(lines).hasSize(0);
fileConsole.progress("This is progress");
}
List<String> lines = Files.readAllLines(file);
assertThat(lines).hasSize(6);
assertThat(lines.get(0)).contains("INFO: Copybara source mover (Version: v1)");
assertThat(lines.get(1)).contains("INFO: This is info");
assertThat(lines.get(2)).contains("WARNING: This is warning");
assertThat(lines.get(3)).contains("ERROR: This is error");
assertThat(lines.get(4)).contains("VERBOSE: This is verbose");
assertThat(lines.get(5)).contains("PROGRESS: This is progress");
}
Aggregations