@Test
    public void testVariables() {
        ArrayDataType iarr = new ArrayDataType(DataType.INT);
        ArrayDataType iiarr = new ArrayDataType(iarr);
        ArrayDataType iiiarr = new ArrayDataType(iiarr);

        DocumentType type = new DocumentType("test");
        type.addField(new Field("iiiarray", iiiarr));

        Array<Array<Array<IntegerFieldValue>>> iiiaV = new Array<>(iiiarr);
        for (int i = 1; i < 4; i++) {
            Array<Array<IntegerFieldValue>> iiaV = new Array<>(iiarr);
            for (int j = 1; j < 4; j++) {
                Array<IntegerFieldValue> iaV = new Array<>(iarr);
                for (int k = 1; k < 4; k++) {
                    iaV.add(new IntegerFieldValue(i * j * k));
                }
                iiaV.add(iaV);
            }
            iiiaV.add(iiaV);
        }

        Document doc = new Document(type, new DocumentId("id:ns:test::"));
        doc.setFieldValue("iiiarray", iiiaV);

        {
            VariableIteratorHandler handler = new VariableIteratorHandler();
            FieldPath path = type.buildFieldPath("iiiarray[$x][$y][$z]");
            doc.iterateNested(path, 0, handler);

            String fasit =
                    "x: 0,y: 0,z: 0, - 1\n" +
                    "x: 0,y: 0,z: 1, - 2\n" +
                    "x: 0,y: 0,z: 2, - 3\n" +
                    "x: 0,y: 1,z: 0, - 2\n" +
                    "x: 0,y: 1,z: 1, - 4\n" +
                    "x: 0,y: 1,z: 2, - 6\n" +
                    "x: 0,y: 2,z: 0, - 3\n" +
                    "x: 0,y: 2,z: 1, - 6\n" +
                    "x: 0,y: 2,z: 2, - 9\n" +
                    "x: 1,y: 0,z: 0, - 2\n" +
                    "x: 1,y: 0,z: 1, - 4\n" +
                    "x: 1,y: 0,z: 2, - 6\n" +
                    "x: 1,y: 1,z: 0, - 4\n" +
                    "x: 1,y: 1,z: 1, - 8\n" +
                    "x: 1,y: 1,z: 2, - 12\n" +
                    "x: 1,y: 2,z: 0, - 6\n" +
                    "x: 1,y: 2,z: 1, - 12\n" +
                    "x: 1,y: 2,z: 2, - 18\n" +
                    "x: 2,y: 0,z: 0, - 3\n" +
                    "x: 2,y: 0,z: 1, - 6\n" +
                    "x: 2,y: 0,z: 2, - 9\n" +
                    "x: 2,y: 1,z: 0, - 6\n" +
                    "x: 2,y: 1,z: 1, - 12\n" +
                    "x: 2,y: 1,z: 2, - 18\n" +
                    "x: 2,y: 2,z: 0, - 9\n" +
                    "x: 2,y: 2,z: 1, - 18\n" +
                    "x: 2,y: 2,z: 2, - 27\n";

            assertEquals(fasit, handler.retVal);
        }
    }
Test for Document and all its features, including (de)serialization.

@author Thomas Gundersen
@author bratseth
document/src/test/java/com/yahoo/document/DocumentTestCase.java