}
public void testMethod2(TestHarness harness)
{
harness.checkPoint("(Object[])");
BeanContextSupport bcs = new BeanContextSupport();
// try null
boolean pass = false;
try
{
bcs.toArray(null);
}
catch (NullPointerException e)
{
pass = true;
}
harness.check(pass);
// try zero length array for zero children
Object[] array1 = new Object[0];
Object[] array2 = bcs.toArray(array1);
harness.check(array2 == array1);
// try array length 1 for zero children
array1 = new Object[1];
array2 = bcs.toArray(array1);
harness.check(array2 == array1);
harness.check(array2[0], null);
// try array length 0 for 1 child
BeanContextSupport child1 = new BeanContextSupport();
bcs.add(child1);
array1 = new Object[0];
array2 = bcs.toArray(array1);
harness.check(array2 != array1);
harness.check(array2.length, 1);