public void test(TestHarness harness)
{
try
{
// printdata matches flavor
new SimpleDoc(new byte[100], DocFlavor.BYTE_ARRAY.GIF, null);
harness.check(true);
}
catch (RuntimeException e)
{
e.printStackTrace();
harness.check(false);
}
try
{
// check for sublcasses of reader
new SimpleDoc(new CharArrayReader(new char[]{'A','b'}),
DocFlavor.READER.TEXT_PLAIN, null);
harness.check(true);
}
catch (RuntimeException e)
{
e.printStackTrace();
harness.check(false);
}
try
{
// printdata does not match flavor
new SimpleDoc(new byte[100], DocFlavor.CHAR_ARRAY.TEXT_PLAIN, null);
harness.check(false);
}
catch (IllegalArgumentException e)
{
harness.check(true);
}
try
{
new SimpleDoc(null, DocFlavor.CHAR_ARRAY.TEXT_PLAIN, null);
harness.check(false);
}
catch (IllegalArgumentException e)
{
harness.check(true);
}
try
{
new SimpleDoc(new String("kk"), null, null);
harness.check(false);
}
catch (IllegalArgumentException e)
{
harness.check(true);