### Question:
SchemaUpdate implements UpdateSchema { @Override public UpdateSchema addRequiredColumn(String name, Type type, String doc) { Preconditions.checkArgument(!name.contains("."), "Cannot add column with ambiguous name: %s, use addColumn(parent, name, type)", name); addRequiredColumn(null, name, type, doc); return this; } SchemaUpdate(TableOperations ops);   SchemaUpdate(Schema schema, int lastColumnId); @Override SchemaUpdate allowIncompatibleChanges(); @Override UpdateSchema addColumn(String name, Type type, String doc); @Override UpdateSchema addColumn(String parent, String name, Type type, String doc); @Override UpdateSchema addRequiredColumn(String name, Type type, String doc); @Override UpdateSchema addRequiredColumn(String parent, String name, Type type, String doc); @Override UpdateSchema deleteColumn(String name); @Override UpdateSchema renameColumn(String name, String newName); @Override UpdateSchema requireColumn(String name); @Override UpdateSchema makeColumnOptional(String name); @Override UpdateSchema updateColumn(String name, Type.PrimitiveType newType); @Override UpdateSchema updateColumnDoc(String name, String doc); @Override UpdateSchema moveFirst(String name); @Override UpdateSchema moveBefore(String name, String beforeName); @Override UpdateSchema moveAfter(String name, String afterName); UpdateSchema updateSchema(Schema newSchema); @Override Schema apply(); @Override void commit();  }### Answer:
@Test public void testAddRequiredColumn() { Schema schema = new Schema(required(1, "id", Types.IntegerType.get())); Schema expected = new Schema( required(1, "id", Types.IntegerType.get()), required(2, "data", Types.StringType.get())); AssertHelpers.assertThrows("Should reject add required column if incompatible changes are not allowed", IllegalArgumentException.class, "Incompatible change: cannot add required column: data", () -> new SchemaUpdate(schema, 1).addRequiredColumn("data", Types.StringType.get())); Schema result = new SchemaUpdate(schema, 1) .allowIncompatibleChanges() .addRequiredColumn("data", Types.StringType.get()) .apply(); Assert.assertEquals("Should add required column", expected.asStruct(), result.asStruct()); }