@Test
    public void testAddAll() {
        DocumentType t1 = new DocumentType("doo");
        DocumentType t2 = new DocumentType("foo");
        Field f1 = new Field("field1", DataType.STRING);
        Field f2 = new Field("field2", DataType.STRING);
        t1.addField(f1);
        t2.addField(f2);

        DocumentUpdate du1 = new DocumentUpdate(t1, new DocumentId("id:this:doo::is:a:test"));
        DocumentUpdate du2 = new DocumentUpdate(t2, "id:this:foo::is:another:test");

        FieldUpdate fu1 = FieldUpdate.createAssign(f1, new StringFieldValue("banana"));
        FieldUpdate fu2 = FieldUpdate.createAssign(f2, new StringFieldValue("apple"));
        du1.addFieldUpdate(fu1);
        du2.addFieldUpdate(fu2);

        du1.addAll(null);

        try {
            du1.addAll(du2);
            fail("Should have gotten exception");
        } catch (IllegalArgumentException iae) {
            //ok!
        }

        DocumentUpdate du3 = new DocumentUpdate(t2, new DocumentId("id:this:foo::is:a:test"));

        try {
            du1.addAll(du3);
            fail("Should have gotten exception");
        } catch (IllegalArgumentException iae) {
            //ok!
        }
    }
Tests applying and serializing document updates.

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