MockExceptionOutputStream out2 = new MockExceptionOutputStream();
ByteArrayOutputStream out3 = new ByteArrayOutputStream();
OutputStream[] outs = new OutputStream[] { out1, out2, out3 };
MultiOutputStream multi = new MultiOutputStream( outs );
byte[] in = "abcd".getBytes();
String outStr1 = "";
String outStr2 = "";
try {
multi.write( 'a' );
} catch ( IOException e ) {
// we expect to get here
assertEquals( "IOException", "Test Exception", e.getMessage() );
}
try {
multi.write( in, 1, 2 );
} catch ( IOException e ) {
// we expect to get here
assertEquals( "IOException", "Test Exception", e.getMessage() );
}
try {
multi.write( in );
} catch ( IOException e ) {
// we expect to get here
assertEquals( "IOException", "Test Exception", e.getMessage() );
}
try {
multi.close();
} catch ( IOException e ) {
// we expect to get here
assertEquals( "IOException", "Test Exception", e.getMessage() );
}