use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class ReplaceTest method setup.
@Before
public void setup() throws IOException {
fs = Jimfs.newFileSystem();
checkoutDir = fs.getPath("/");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
options = new OptionsBuilder().setConsole(console);
skylark = new SkylarkTestExecutor(options);
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class TodoReplaceTest method setup.
@Before
public void setup() throws IOException {
FileSystem fs = Jimfs.newFileSystem();
checkoutDir = fs.getPath("/");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
OptionsBuilder options = new OptionsBuilder().setConsole(console);
skylark = new SkylarkTestExecutor(options);
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class PatchTransformationTest method setup.
@Before
public void setup() throws IOException {
checkoutDir = Files.createTempDirectory("workdir");
Files.createDirectories(checkoutDir);
console = new TestingConsole();
options = new OptionsBuilder().setConsole(console);
patchingOptions = options.build().get(PatchingOptions.class);
skylark = new SkylarkTestExecutor(options);
ImmutableMap<String, byte[]> configFiles = ImmutableMap.of("diff.patch", (DIFF).getBytes(UTF_8), "series", ("diff.patch\n").getBytes(UTF_8));
patchFile = new MapConfigFile(configFiles, "diff.patch");
seriesFile = new MapConfigFile(configFiles, "series");
options.setEnvironment(GitTestUtil.getGitEnv().getEnvironment());
// In preparation to switch to the new default. PatchingOptionsTest has more coverage on this.
options.patch.useGitApply = false;
options.patch.skipVersionCheck = false;
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class ConsoleTest method captureOnlyConsole.
@Test
public void captureOnlyConsole() throws Exception {
TestingConsole delegate = new TestingConsole().respondYes();
CapturingConsole console = CapturingConsole.captureOnlyConsole(delegate, MessageType.ERROR, MessageType.WARNING);
console.error("This is error!");
console.warn("This is warning");
console.info("This is info");
console.progress("This is progress");
console.promptConfirmation("Do you want to continue?");
assertThat(console.getMessages()).containsExactly(new Message(MessageType.ERROR, "This is error!"), new Message(MessageType.WARNING, "This is warning"));
delegate.assertThat().matchesNext(MessageType.ERROR, "This is error!").matchesNext(MessageType.WARNING, "This is warning").matchesNext(MessageType.INFO, "This is info").matchesNext(MessageType.PROGRESS, "This is progress").matchesNext(MessageType.WARNING, "Do you want to continue[?]").containsNoMoreMessages();
}
use of com.google.copybara.util.console.testing.TestingConsole in project copybara by google.
the class ConsoleTest method progressPrefix.
@Test
public void progressPrefix() {
TestingConsole delegate = new TestingConsole();
Console console = new PrefixConsole("FOO ", delegate);
console.progress("bar");
console.info("bar");
console.warn("bar");
console.error("bar");
delegate.assertThat().matchesNext(MessageType.PROGRESS, "FOO bar").matchesNext(MessageType.INFO, "FOO bar").matchesNext(MessageType.WARNING, "FOO bar").matchesNext(MessageType.ERROR, "FOO bar").containsNoMoreMessages();
}
Aggregations