@Test
public void testDefault() {
Schema schema = new Schema(new Field("field", Type.INT32, "doc", 42));
Struct struct = new Struct(schema);
assertEquals("Should get the default value", 42, struct.get("field"));
struct.validate(); // should be valid even with missing value
}
private Object roundtrip(Type type, Object obj) {
ByteBuffer buffer = ByteBuffer.allocate(type.sizeOf(obj));
type.write(buffer, obj);