mirror of
https://github.com/google/nomulus.git
synced 2025-06-05 20:17:27 +02:00
Fix command tests that set stdout/stderr (#258)
* Fix command tests that set stdout/stderr CommandTestCase already wraps stdout stderr, just use the provided methods.
This commit is contained in:
parent
729b69550e
commit
c5e4e862bd
2 changed files with 2 additions and 12 deletions
|
@ -34,8 +34,6 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Range;
|
import com.google.common.collect.Range;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.model.registry.Registry;
|
import google.registry.model.registry.Registry;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
@ -472,14 +470,11 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_setCommonAndReservedListFromOtherTld_withOverride() throws Exception {
|
public void testSuccess_setCommonAndReservedListFromOtherTld_withOverride() throws Exception {
|
||||||
ByteArrayOutputStream errContent = new ByteArrayOutputStream();
|
|
||||||
System.setErr(new PrintStream(errContent));
|
|
||||||
runReservedListsTestOverride("common_abuse,tld_banned");
|
runReservedListsTestOverride("common_abuse,tld_banned");
|
||||||
String errMsg =
|
String errMsg =
|
||||||
"Error overridden: The reserved list(s) tld_banned "
|
"Error overridden: The reserved list(s) tld_banned "
|
||||||
+ "cannot be applied to the tld xn--q9jyb4c";
|
+ "cannot be applied to the tld xn--q9jyb4c";
|
||||||
assertThat(errContent.toString()).contains(errMsg);
|
assertThat(getStderrAsString()).contains(errMsg);
|
||||||
System.setOut(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -38,8 +38,6 @@ import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.model.registry.Registry;
|
import google.registry.model.registry.Registry;
|
||||||
import google.registry.model.registry.label.PremiumList;
|
import google.registry.model.registry.label.PremiumList;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.PrintStream;
|
|
||||||
import org.joda.money.Money;
|
import org.joda.money.Money;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.Duration;
|
import org.joda.time.Duration;
|
||||||
|
@ -898,14 +896,11 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_setCommonAndReservedListFromOtherTld_withOverride() throws Exception {
|
public void testSuccess_setCommonAndReservedListFromOtherTld_withOverride() throws Exception {
|
||||||
ByteArrayOutputStream errContent = new ByteArrayOutputStream();
|
|
||||||
System.setErr(new PrintStream(errContent));
|
|
||||||
runReservedListsTestOverride("common_abuse,tld_banned");
|
runReservedListsTestOverride("common_abuse,tld_banned");
|
||||||
String errMsg =
|
String errMsg =
|
||||||
"Error overridden: The reserved list(s) tld_banned "
|
"Error overridden: The reserved list(s) tld_banned "
|
||||||
+ "cannot be applied to the tld xn--q9jyb4c";
|
+ "cannot be applied to the tld xn--q9jyb4c";
|
||||||
assertThat(errContent.toString()).contains(errMsg);
|
assertThat(getStderrAsString()).contains(errMsg);
|
||||||
System.setOut(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue