* Try to write to a buffer that is too small. This should
* throw an Exception
*/
public void testWriteArrayStoreException()
{
ClassID clsidTest = new ClassID(
new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
, 0
);
boolean bExceptionOccurred = false;
try
{
clsidTest.write(new byte[15], 0);
}
catch (Exception e)
{
bExceptionOccurred = true;
}
Assert.assertTrue(bExceptionOccurred);
bExceptionOccurred = false;
try
{
clsidTest.write(new byte[16], 1);
}
catch (Exception e)
{
bExceptionOccurred = true;
}
Assert.assertTrue(bExceptionOccurred);
// These should work without throwing an Exception
bExceptionOccurred = false;
try
{
clsidTest.write(new byte[16], 0);
clsidTest.write(new byte[17], 1);
}
catch (Exception e)
{
bExceptionOccurred = true;
}