@Test
public void testSparseArray() throws Exception {
Context context = getContext();
// xsd:string[2,3,4]
ElementReader reader = new ElementReader(getClass().getResourceAsStream("arraySparse1.xml"));
String[][][] strings = (String[][][]) createArrayType(String[][][].class).readObject(reader, context);
reader.getXMLStreamReader().close();
verifySparseArray(strings);
// xsd:string[,][4] -> xsd:string[3,4]
reader = new ElementReader(getClass().getResourceAsStream("arraySparse2.xml"));
strings = (String[][][]) createArrayType(String[][][].class).readObject(reader, context);
reader.getXMLStreamReader().close();
verifySparseArray(strings);
// xsd:string[,][4] -> xsd:string[][3] -> xsd:string[4]
reader = new ElementReader(getClass().getResourceAsStream("arraySparse3.xml"));
strings = (String[][][]) createArrayType(String[][][].class).readObject(reader, context);
reader.getXMLStreamReader().close();
verifySparseArray(strings);
// round trip tests
strings = readWriteReadRef("arraySparse1.xml", String[][][].class);
verifySparseArray(strings);