Add gTech command to get .app domain info

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127582475
This commit is contained in:
mcilwain 2016-07-15 14:59:58 -07:00 committed by Ben McIlwain
parent b9d1a4362f
commit d9596fa30c
2 changed files with 13 additions and 2 deletions

View file

@ -49,7 +49,8 @@ import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public abstract class CommandTestCase<C extends Command> {
private ByteArrayOutputStream stdout = new ByteArrayOutputStream();
private final ByteArrayOutputStream stdout = new ByteArrayOutputStream();
private final ByteArrayOutputStream stderr = new ByteArrayOutputStream();
protected C command;
@ -71,6 +72,7 @@ public abstract class CommandTestCase<C extends Command> {
RegistryToolEnvironment.UNITTEST.setup();
command = newCommandInstance();
System.setOut(new PrintStream(stdout));
System.setErr(new PrintStream(stderr));
}
void runCommandInEnvironment(RegistryToolEnvironment env, String... args) throws Exception {
@ -156,6 +158,13 @@ public abstract class CommandTestCase<C extends Command> {
}
}
protected void assertInStderr(String... expected) throws Exception {
String stderror = new String(stderr.toByteArray(), UTF_8);
for (String line : expected) {
assertThat(stderror).contains(line);
}
}
void assertNotInStdout(String expected) throws Exception {
assertThat(getStdoutAsString()).doesNotContain(expected);
}