mirror of
https://github.com/google/nomulus
synced 2026-09-26 18:04:36 +00:00
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:
@@ -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",
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user