use of tests.support.Support_OutputStream in project j2objc by google.
the class OldOutputStreamWriterTest method test_ConstructorLjava_io_OutputStreamLjava_nio_charset_Charset.
public void test_ConstructorLjava_io_OutputStreamLjava_nio_charset_Charset() throws IOException {
OutputStreamWriter writer;
Support_OutputStream out = new Support_OutputStream();
Charset cs = Charset.forName("ascii");
try {
writer = new OutputStreamWriter(null, cs);
fail("Test 1: NullPointerException expected.");
} catch (NullPointerException e) {
// Expected
}
try {
writer = new OutputStreamWriter(out, (Charset) null);
fail("Test 2: NullPointerException expected.");
} catch (NullPointerException e) {
// Expected
}
writer = new OutputStreamWriter(out, cs);
assertEquals("Test 3: Encoding not set correctly. ", cs, Charset.forName(writer.getEncoding()));
writer.close();
}
use of tests.support.Support_OutputStream in project j2objc by google.
the class OldOutputStreamWriterTest method test_ConstructorLjava_io_OutputStreamLjava_nio_charset_CharsetEncoder.
public void test_ConstructorLjava_io_OutputStreamLjava_nio_charset_CharsetEncoder() throws IOException {
OutputStreamWriter writer;
Support_OutputStream out = new Support_OutputStream();
Charset cs = Charset.forName("ascii");
CharsetEncoder enc = cs.newEncoder();
try {
writer = new OutputStreamWriter(null, enc);
fail("Test 1: NullPointerException expected.");
} catch (NullPointerException e) {
// Expected
}
try {
writer = new OutputStreamWriter(out, (CharsetEncoder) null);
fail("Test 2: NullPointerException expected.");
} catch (NullPointerException e) {
// Expected
}
writer = new OutputStreamWriter(out, cs);
assertEquals("Test 3: CharacterEncoder not set correctly. ", cs, Charset.forName(writer.getEncoding()));
writer.close();
}
use of tests.support.Support_OutputStream in project j2objc by google.
the class OldOutputStreamWriterTest method setUp.
protected void setUp() throws Exception {
super.setUp();
fos = new Support_OutputStream(500);
osw = new OutputStreamWriter(fos, "UTF-8");
}
use of tests.support.Support_OutputStream in project j2objc by google.
the class OldOutputStreamWriterTest method test_getEncoding.
public void test_getEncoding() throws IOException {
OutputStreamWriter writer;
writer = new OutputStreamWriter(new Support_OutputStream(), "utf-8");
assertEquals("Test 1: Incorrect encoding returned.", Charset.forName("utf-8"), Charset.forName(writer.getEncoding()));
writer.close();
assertNull("Test 2: getEncoding() did not return null for a closed writer.", writer.getEncoding());
}
use of tests.support.Support_OutputStream in project j2objc by google.
the class OldDataOutputStreamTest method setUp.
protected void setUp() {
sos = new Support_OutputStream(true);
bos = new ByteArrayOutputStream();
os = new DataOutputStream(bos);
}
Aggregations