@Test
    public void testInheritanceTypeMismatch() {
        DocumentType parentType = new DocumentType("parent");
        parentType.addField(new Field("parentbodyint", DataType.INT));
        parentType.addField(new Field("parentheaderint", DataType.INT));
        parentType.addField(new Field("overwritten", DataType.STRING));
        DocumentType childType = new DocumentType("child");
        childType.addField(new Field("childbodyint", DataType.INT));
        childType.addField(new Field("childheaderint", DataType.INT));
        childType.addField(new Field("overwritten", DataType.INT));
        try {
            childType.inherit(parentType);
            fail("Inheritance with conflicting types worked.");
        } catch (IllegalArgumentException e) {
            assertEquals(e.getMessage(),
                         "Inheritance type mismatch: field \"overwritten\" in datatype \"child\" must have same datatype as in parent document type \"parent\"");
        }
    }
Test for Document and all its features, including (de)serialization.

@author Thomas Gundersen
@author bratseth
document/src/test/java/com/yahoo/document/DocumentTestCase.java