@Test
    public void testGetAndRemoveByName() {
        DocumentType docType = new DocumentType("my_type");
        Field my_int = new Field("my_int", DataType.INT);
        Field your_int = new Field("your_int", DataType.INT);
        docType.addField(my_int);
        docType.addField(your_int);
        DocumentUpdate update = new DocumentUpdate(docType, new DocumentId("id:this:my_type::is:a:test"));

        update.addFieldUpdate(FieldUpdate.createAssign(my_int, new IntegerFieldValue(2)));
        assertNull(update.getFieldUpdate("none-existing-field"));
        assertNull(update.removeFieldUpdate("none-existing-field"));
        assertNull(update.getFieldUpdate("your_int"));
        assertEquals(new IntegerFieldValue(2), update.getFieldUpdate("my_int").getValueUpdate(0).getValue());
        assertNull(update.removeFieldUpdate("your_int"));
        assertEquals(new IntegerFieldValue(2), update.removeFieldUpdate("my_int").getValueUpdate(0).getValue());
        assertNull(update.getFieldUpdate("my_int"));

        update.addFieldUpdate(FieldUpdate.createAssign(my_int, new IntegerFieldValue(2)));
        assertNull(update.getFieldUpdate(your_int));
        assertEquals(new IntegerFieldValue(2), update.getFieldUpdate(my_int).getValueUpdate(0).getValue());
        assertNull(update.removeFieldUpdate(your_int));
        assertEquals(new IntegerFieldValue(2), update.removeFieldUpdate(my_int).getValueUpdate(0).getValue());
        assertNull(update.getFieldUpdate(my_int));
    }
Tests applying and serializing document updates.

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