@Test
    public void testAssignMapStructVariable() {
        Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
        MapFieldValue mfv = new MapFieldValue((MapDataType)doc.getField("structmap").getDataType());
        Struct fv1 = new Struct(mfv.getDataType().getValueType());
        fv1.setFieldValue(fv1.getField("title"), new StringFieldValue("thomas"));
        fv1.setFieldValue(fv1.getField("rating"), new IntegerFieldValue(32));

        mfv.put(new StringFieldValue("foo"), fv1);

        Struct fv2 = new Struct(mfv.getDataType().getValueType());
        fv2.setFieldValue(fv2.getField("title"), new StringFieldValue("cyril"));
        fv2.setFieldValue(fv2.getField("rating"), new IntegerFieldValue(16));

        mfv.put(new StringFieldValue("bar"), fv2);

        Struct fv3 = new Struct(mfv.getDataType().getValueType());
        fv3.setFieldValue(fv3.getField("title"), new StringFieldValue("ulf"));
        fv3.setFieldValue(fv3.getField("rating"), new IntegerFieldValue(8));

        mfv.put(new StringFieldValue("zoo"), fv3);

        doc.setFieldValue(doc.getField("structmap"), mfv);

        Struct fv4 = new Struct(mfv.getDataType().getValueType());
        fv4.setFieldValue(fv4.getField("title"), new StringFieldValue("cyril"));
        fv4.setFieldValue(fv4.getField("rating"), new IntegerFieldValue(48));

        DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
        docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "structmap{$x}.rating", "foobar.structmap{$x}.title == \"cyril\"", new IntegerFieldValue(48)));
        docUp.applyTo(doc);

        MapFieldValue valueNow = (MapFieldValue)doc.getFieldValue("structmap");
        assertEquals(fv1, valueNow.get(new StringFieldValue("foo")));
        assertEquals(fv4, valueNow.get(new StringFieldValue("bar")));
        assertEquals(fv3, valueNow.get(new StringFieldValue("zoo")));
    }
Tests applying and serializing document updates.

@author Einar M R Rosenvinge
document/src/test/java/com/yahoo/document/DocumentPathUpdateTestCase.java