Use constant for utf-8 encoding

This commit is contained in:
Fredrik Fornwall
2019-01-20 23:58:04 +01:00
parent 4df285013e
commit 70c1bddae0

View File

@@ -4,7 +4,6 @@ import junit.framework.AssertionFailedError;
import junit.framework.TestCase; import junit.framework.TestCase;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@@ -27,14 +26,10 @@ public abstract class TerminalTestCase extends TestCase {
} }
public String getOutputAndClear() { public String getOutputAndClear() {
try { String result = new String(baos.toByteArray(), StandardCharsets.UTF_8);
String result = new String(baos.toByteArray(), "UTF-8"); baos.reset();
baos.reset(); return result;
return result; }
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
@Override @Override
public void titleChanged(String oldTitle, String newTitle) { public void titleChanged(String oldTitle, String newTitle) {