mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 14:54:51 +02:00
Add better assertions on registry_tool stdout
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=127561648
This commit is contained in:
parent
bca9b2a806
commit
60180348cd
1 changed files with 8 additions and 3 deletions
|
@ -145,17 +145,22 @@ public abstract class CommandTestCase<C extends Command> {
|
||||||
return ofy().load().type(PollMessage.class).count();
|
return ofy().load().type(PollMessage.class).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void assertStdoutIs(String expected) throws Exception {
|
||||||
|
assertThat(getStdoutAsString()).isEqualTo(expected);
|
||||||
|
}
|
||||||
|
|
||||||
protected void assertInStdout(String... expected) throws Exception {
|
protected void assertInStdout(String... expected) throws Exception {
|
||||||
|
String stdout = getStdoutAsString();
|
||||||
for (String line : expected) {
|
for (String line : expected) {
|
||||||
assertThat(stdout.toString(UTF_8.toString())).contains(line);
|
assertThat(stdout).contains(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertNotInStdout(String expected) throws Exception {
|
void assertNotInStdout(String expected) throws Exception {
|
||||||
assertThat(stdout.toString(UTF_8.toString())).doesNotContain(expected);
|
assertThat(getStdoutAsString()).doesNotContain(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getStdoutAsString() {
|
protected String getStdoutAsString() {
|
||||||
return new String(stdout.toByteArray(), UTF_8);
|
return new String(stdout.toByteArray(), UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue