CreateObjectOptions { public static Builder builder() { return new AutoValue_CreateObjectOptions.Builder() .setContentEncoding(null) .setContentType(CONTENT_TYPE_DEFAULT) .setEnsureEmptyObjectsMetadataMatch(true) .setKmsKeyName(null) .setMetadata(ImmutableMap.of()) .setOverwriteExisting(false); }  static Builder builder(); abstract Builder toBuilder(); @Nullable abstract String getContentEncoding(); @Nullable abstract String getContentType(); abstract boolean isEnsureEmptyObjectsMetadataMatch(); @Nullable abstract String getKmsKeyName(); abstract ImmutableMap<String, byte[]> getMetadata(); abstract boolean isOverwriteExisting(); static final String CONTENT_TYPE_DEFAULT; static final CreateObjectOptions DEFAULT_NO_OVERWRITE; static final CreateObjectOptions DEFAULT_OVERWRITE; }
@Test public void build_checksContentTypeMetadata() { CreateObjectOptions.builder() .setMetadata(ImmutableMap.of("Innocuous-Type", "".getBytes(UTF_8))) .build(); assertThrows( IllegalArgumentException.class, () -> CreateObjectOptions.builder() .setMetadata(ImmutableMap.of("Content-Type", "".getBytes(UTF_8))) .build()); }
@Test public void build_checksContentEncodingMetadata() { CreateObjectOptions.builder() .setMetadata(ImmutableMap.of("Innocuous-Encoding", "".getBytes(UTF_8))) .build(); assertThrows( IllegalArgumentException.class, () -> CreateObjectOptions.builder() .setMetadata(ImmutableMap.of("Content-Encoding", "".getBytes(UTF_8))) .build()); }