Search in sources :

Example 26 with Support_ASimpleInputStream

use of tests.support.Support_ASimpleInputStream in project robovm by robovm.

the class Test method test_readLine_IOException.

public void test_readLine_IOException() throws IOException {
    oos.writeObject(testString);
    oos.close();
    Support_ASimpleInputStream sis = new Support_ASimpleInputStream(bao.toByteArray());
    ois = new ObjectInputStream(sis);
    sis.throwExceptionOnNextUse = true;
    try {
        ois.readLine();
        fail("Test 1: IOException expected.");
    } catch (IOException e) {
    // Expected.
    }
    sis.throwExceptionOnNextUse = false;
    ois.close();
}
Also used : Support_ASimpleInputStream(tests.support.Support_ASimpleInputStream) IOException(java.io.IOException) ObjectInputStream(java.io.ObjectInputStream)

Example 27 with Support_ASimpleInputStream

use of tests.support.Support_ASimpleInputStream in project robovm by robovm.

the class Test method test_ConstructorLjava_io_InputStream_IOException.

public void test_ConstructorLjava_io_InputStream_IOException() throws IOException {
    oos.writeObject(testString);
    oos.close();
    Support_ASimpleInputStream sis = new Support_ASimpleInputStream(bao.toByteArray());
    sis.throwExceptionOnNextUse = true;
    try {
        ois = new ObjectInputStream(sis);
        fail("Test 1: IOException expected.");
    } catch (IOException e) {
    // Expected.
    }
    sis.throwExceptionOnNextUse = false;
}
Also used : Support_ASimpleInputStream(tests.support.Support_ASimpleInputStream) IOException(java.io.IOException) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

Support_ASimpleInputStream (tests.support.Support_ASimpleInputStream)27 IOException (java.io.IOException)24 ObjectInputStream (java.io.ObjectInputStream)10 DataInputStream (java.io.DataInputStream)4 SequenceInputStream (java.io.SequenceInputStream)4 BufferedInputStream (java.io.BufferedInputStream)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStreamReader (java.io.InputStreamReader)2 StreamTokenizer (java.io.StreamTokenizer)2 Support_StringReader (tests.support.Support_StringReader)2 DigestInputStream (java.security.DigestInputStream)1