@Test
    public void testGenerateSerializedFile() throws IOException {
        docMan = DocumentTestCase.setUpCppDocType();

        DocumentType type = docMan.getDocumentType("serializetest");
        DocumentUpdate upd = new DocumentUpdate(type, new DocumentId("id:ns:serializetest::update"));
        FieldUpdate serAssign = FieldUpdate.createAssign(type.getField("intfield"), new IntegerFieldValue(4));
        upd.addFieldUpdate(serAssign);
        FieldUpdate serClearField = FieldUpdate.createClearField(type.getField("floatfield"));
        upd.addFieldUpdate(serClearField);
        List<FloatFieldValue> arrayOfFloat = new ArrayList<>();
        arrayOfFloat.add(new FloatFieldValue(5.00f));
        arrayOfFloat.add(new FloatFieldValue(4.23f));
        arrayOfFloat.add(new FloatFieldValue(-1.00f));
        FieldUpdate serAdd = FieldUpdate.createAddAll(type.getField("arrayoffloatfield"), arrayOfFloat);
        upd.addFieldUpdate(serAdd);

        GrowableByteBuffer buf = new GrowableByteBuffer(100, 2.0f);
        upd.serialize(DocumentSerializerFactory.createHead(buf));
        buf.flip();

        writeBufferToFile(buf, "src/tests/data/serializeupdatejava.dat");
    }
Tests applying and serializing document updates.

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