@Test
    public void testAddAndAssignList() {
        Document doc = new Document(docMan.getDocumentType("foobar"), new DocumentId("id:ns:foobar::foooo"));
        assertNull(doc.getFieldValue("strarray"));

        Array strArray = new Array(doc.getField("strarray").getDataType());
        strArray.add(new StringFieldValue("hello hello"));
        strArray.add(new StringFieldValue("blah blah"));
        doc.setFieldValue("strarray", strArray);
        assertNotNull(doc.getFieldValue("strarray"));

        DocumentUpdate docUp = new DocumentUpdate(docType, new DocumentId("id:ns:foobar::bar"));
        docUp.addFieldPathUpdate(new AssignFieldPathUpdate(doc.getDataType(), "strarray[1]", "", new StringFieldValue("assigned val 1")));

        Array adds = new Array(doc.getField("strarray").getDataType());
        adds.add(new StringFieldValue("new value"));

        docUp.addFieldPathUpdate(new AddFieldPathUpdate(doc.getDataType(), "strarray", "", adds));

        docUp.applyTo(doc);
        List docList = (List) doc.getFieldValue("strarray");
        assertEquals(3, docList.size());
        assertEquals(new StringFieldValue("hello hello"), docList.get(0));
        assertEquals(new StringFieldValue("assigned val 1"), docList.get(1));
        assertEquals(new StringFieldValue("new value"), docList.get(2));
    }
Tests applying and serializing document updates.

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