public static List<UpdateRequirement> forUpdateTable(
      TableMetadata base, List<MetadataUpdate> metadataUpdates) {
    Preconditions.checkArgument(null != base, "Invalid table metadata: null");
    Preconditions.checkArgument(null != metadataUpdates, "Invalid metadata updates: null");
    Builder builder = new Builder(base, false);
    builder.require(new UpdateRequirement.AssertTableUUID(base.uuid()));
    metadataUpdates.forEach(builder::update);
    return builder.build();
  }
@Test
  public void setCurrentSchemaFailure() {
    int schemaId = 3;
    when(metadata.currentSchemaId()).thenReturn(schemaId);
    when(updated.currentSchemaId()).thenReturn(schemaId + 1);

    List<UpdateRequirement> requirements =
        UpdateRequirements.forUpdateTable(
            metadata,
            ImmutableList.of(
                new MetadataUpdate.SetCurrentSchema(schemaId),
                new MetadataUpdate.SetCurrentSchema(schemaId + 1),
                new MetadataUpdate.SetCurrentSchema(schemaId + 2)));

    assertThatThrownBy(() -> requirements.forEach(req -> req.validate(updated)))
        .isInstanceOf(CommitFailedException.class)
        .hasMessage("Requirement failed: current schema changed: expected id 3 != 4");
  }