public static List<UpdateRequirement> forReplaceView(
      ViewMetadata base, List<MetadataUpdate> metadataUpdates) {
    Preconditions.checkArgument(null != base, "Invalid view metadata: null");
    Preconditions.checkArgument(null != metadataUpdates, "Invalid metadata updates: null");
    Builder builder = new Builder(null, false);
    builder.require(new UpdateRequirement.AssertViewUUID(base.uuid()));
    metadataUpdates.forEach(builder::update);
    return builder.build();
  }
@Test
  public void assignUUIDToViewFailure() {
    List<UpdateRequirement> requirements =
        UpdateRequirements.forReplaceView(
            viewMetadata, ImmutableList.of(new MetadataUpdate.AssignUUID(viewMetadata.uuid())));

    when(updatedViewMetadata.uuid()).thenReturn(UUID.randomUUID().toString());
    assertThatThrownBy(() -> requirements.forEach(req -> req.validate(updatedViewMetadata)))
        .isInstanceOf(CommitFailedException.class)
        .hasMessage(
            String.format(
                "Requirement failed: view UUID does not match: expected %s != %s",
                updatedViewMetadata.uuid(), viewMetadata.uuid()));
  }