@Test
    public void testUpdatesToTheSameFieldAreCombining() {
        DocumentType docType = new DocumentType("my_type");
        Field field = new Field("my_int", DataType.INT);
        docType.addField(field);

        DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:ns:my_type::foo:"));
        update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(1)));
        update.addFieldUpdate(FieldUpdate.createAssign(field, new IntegerFieldValue(2)));
        assertEquals(1, update.fieldUpdates().size());
        FieldUpdate fieldUpdate = update.getFieldUpdate(field);
        assertNotNull(fieldUpdate);
        assertEquals(field, fieldUpdate.getField());
        assertEquals(2, fieldUpdate.getValueUpdates().size());
        ValueUpdate valueUpdate = fieldUpdate.getValueUpdate(0);
        assertNotNull(valueUpdate);
        assertTrue(valueUpdate instanceof AssignValueUpdate);
        assertEquals(new IntegerFieldValue(1), valueUpdate.getValue());
        assertNotNull(valueUpdate = fieldUpdate.getValueUpdate(1));
        assertTrue(valueUpdate instanceof AssignValueUpdate);
        assertEquals(new IntegerFieldValue(2), valueUpdate.getValue());
    }
Tests applying and serializing document updates.

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