@Test
public void addRequiredField() {

    FileDescriptor updatedFile = mutateFile(fileBuilder ->
            fileBuilder.getMessageTypeBuilderList().forEach(message -> {
                if (message.getName().equals("MySimpleRecord")) {
                    message.addField(DescriptorProtos.FieldDescriptorProto.newBuilder()
                            .setLabel(DescriptorProtos.FieldDescriptorProto.Label.LABEL_REQUIRED)
                            .setType(DescriptorProtos.FieldDescriptorProto.Type.TYPE_INT32)
                            .setName("new_int_field")
                            .setNumber(message.getFieldList().stream().mapToInt(DescriptorProtos.FieldDescriptorProto::getNumber).max().getAsInt() + 1)
                    );
                }
            })
    );
    assertInvalid("required field added to record type", TestRecords1Proto.getDescriptor(), updatedFile);
    RecordMetaData metaData1 = RecordMetaData.build(TestRecords1Proto.getDescriptor());
    RecordMetaData metaData2 = replaceRecordsDescriptor(metaData1, updatedFile);
    assertInvalid("required field added to record type", metaData1, metaData2);
}