use of org.jpox.samples.array.InterfaceArray in project tests by datanucleus.
the class ArrayTest method testInterfaceArray.
/**
* Test for a field of type Interface[] stored serialised or in a join table.
*/
public void testInterfaceArray() {
Shape[] shapes1 = new Shape[2];
shapes1[0] = new Rectangle(1, 25.0, 20.0);
shapes1[1] = new Rectangle(2, 35.0, 10.0);
Shape[] shapes2 = new Shape[2];
shapes2[0] = new Rectangle(3, 25.0, 20.0);
shapes2[1] = new Rectangle(4, 35.0, 10.0);
InterfaceArray holder = new InterfaceArray(shapes1, shapes2);
Shape[] expectedShapes1 = new Shape[2];
expectedShapes1[0] = (Shape) ((Rectangle) shapes1[0]).clone();
expectedShapes1[1] = (Shape) ((Rectangle) shapes1[1]).clone();
Shape[] expectedShapes2 = new Shape[2];
expectedShapes2[0] = (Shape) ((Rectangle) shapes2[0]).clone();
expectedShapes2[1] = (Shape) ((Rectangle) shapes2[1]).clone();
performArrayTest(holder, Shape[].class, expectedShapes1, expectedShapes2, 0.0);
holder = new InterfaceArray(null, null);
performArrayTest(holder, Shape[].class, null, null, 0.0);
clean(Rectangle.class);
}
use of org.jpox.samples.array.InterfaceArray in project tests by datanucleus.
the class ArrayTest method testJoinTableInterfaceQueryArray.
/**
* Test for a field of type Interface[] stored using a join table.
*/
public void testJoinTableInterfaceQueryArray() {
Shape[] shapes1 = new Shape[2];
shapes1[0] = new Rectangle(1, 25.0, 20.0);
shapes1[1] = new Rectangle(2, 35.0, 10.0);
Shape[] shapes2 = new Shape[2];
shapes2[0] = new Rectangle(3, 25.0, 20.0);
shapes2[1] = new Rectangle(4, 35.0, 10.0);
InterfaceArray holder = new InterfaceArray(shapes1, shapes2);
Shape[] expectedShapes1 = new Shape[2];
expectedShapes1[0] = (Shape) ((Rectangle) shapes1[0]).clone();
expectedShapes1[1] = (Shape) ((Rectangle) shapes1[1]).clone();
performArrayQueryTest(holder, Shape[].class, expectedShapes1);
clean(Rectangle.class);
}
Aggregations