Fix unicode issue in GetTldCommand (#2108)

This commit is contained in:
Weimin Yu
2023-08-16 12:24:35 -04:00
committed by GitHub
parent 99840488a1
commit 68d35d2d95
3 changed files with 12 additions and 9 deletions
@@ -80,11 +80,12 @@ public abstract class CommandTestCase<C extends Command> {
RegistryToolEnvironment.UNITTEST.setup(systemPropertyExtension);
command = newCommandInstance();
// Capture standard output/error.
// Capture standard output/error. Use a single-byte encoding to emulate platforms where default
// charset is not UTF_8.
oldStdout = System.out;
System.setOut(new PrintStream(new OutputSplitter(System.out, stdout)));
System.setOut(new PrintStream(new OutputSplitter(System.out, stdout), false, "US-ASCII"));
oldStderr = System.err;
System.setErr(new PrintStream(new OutputSplitter(System.err, stderr)));
System.setErr(new PrintStream(new OutputSplitter(System.err, stderr), false, "US-ASCII"));
}
@AfterEach
@@ -20,14 +20,11 @@ import static google.registry.testing.TestDataHelper.loadFile;
import static org.junit.jupiter.api.Assertions.assertThrows;
import com.beust.jcommander.ParameterException;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link GetTldCommand}. */
class GetTldCommandTest extends CommandTestCase<GetTldCommand> {
// TODO (sarahbot): re-enable this test after we figure out why it fails during RC build.
@Disabled
@Test
void testSuccess() throws Exception {
createTld("xn--q9jyb4c");