OutputStream out2 = new MockExceptionOutputStream();
SimpleContentItem item1 = new SimpleContentItem( out1 );
SimpleContentItem item2 = new SimpleContentItem( out2 );
MultiContentItem multiContent = new MultiContentItem();
multiContent.addContentItem( item1 );
multiContent.addContentItem( item2 );
byte[] in = "abcd".getBytes();
String outStr1 = "";
String outStr2 = "";
try {
OutputStream multi = multiContent.getOutputStream( "" );
multi.write( 'a' );
// we should not get here
assertFalse( "IOException expected", true );
} catch ( IOException e ) {
assertNotNull( "IOException expected", e );
}
try {
multiContent.closeOutputStream();
} catch ( Exception e ) {
// we should not get here
assertEquals( "IOException", null, e );
}
outStr1 = new String( out1.toByteArray() );