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

@ -13,7 +13,9 @@ java_library(
srcs = glob([ srcs = glob([
"*.java", "*.java",
]), ]),
resources = glob(["testdata/*.*"]), resources = glob([
"testdata/*.*",
]),
deps = [ deps = [
"//java/com/google/common/annotations", "//java/com/google/common/annotations",
"//java/com/google/common/base", "//java/com/google/common/base",

View file

@ -49,7 +49,8 @@ import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public abstract class CommandTestCase<C extends Command> { 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; protected C command;
@ -71,6 +72,7 @@ public abstract class CommandTestCase<C extends Command> {
RegistryToolEnvironment.UNITTEST.setup(); RegistryToolEnvironment.UNITTEST.setup();
command = newCommandInstance(); command = newCommandInstance();
System.setOut(new PrintStream(stdout)); System.setOut(new PrintStream(stdout));
System.setErr(new PrintStream(stderr));
} }
void runCommandInEnvironment(RegistryToolEnvironment env, String... args) throws Exception { 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 { void assertNotInStdout(String expected) throws Exception {
assertThat(getStdoutAsString()).doesNotContain(expected); assertThat(getStdoutAsString()).doesNotContain(expected);
} }