CreateFileOptions { public static Builder builder() { return new AutoValue_CreateFileOptions.Builder() .setAttributes(ImmutableMap.of()) .setContentType(CreateObjectOptions.CONTENT_TYPE_DEFAULT) .setEnsureNoDirectoryConflict(true) .setEnsureParentDirectoriesExist(true) .setOverwriteExisting(false) .setOverwriteGenerationId(StorageResourceId.UNKNOWN_GENERATION_ID); }  static Builder builder(); abstract Builder toBuilder(); abstract ImmutableMap<String, byte[]> getAttributes(); @Nullable abstract String getContentType(); abstract boolean isEnsureNoDirectoryConflict(); abstract boolean isEnsureParentDirectoriesExist(); abstract boolean isOverwriteExisting(); abstract long getOverwriteGenerationId(); static final CreateFileOptions DEFAULT_NO_OVERWRITE; static final CreateFileOptions DEFAULT_OVERWRITE; }
@Test public void testChecksForContentTypeAttributes() { CreateFileOptions.builder() .setOverwriteExisting(true) .setContentType("") .setAttributes(ImmutableMap.of("Innocuous", "".getBytes(UTF_8))) .build(); assertThrows( IllegalArgumentException.class, () -> CreateFileOptions.builder() .setOverwriteExisting(true) .setContentType("") .setAttributes(ImmutableMap.of("Content-Type", "".getBytes(UTF_8))) .build()); }