@Test
public void testCustomBucketWriterRoleAssignment() {

    when(configuration.isDefaultS3WriterRoleEnabled()).thenReturn(true);
    ContainerInfo.Builder containerInfoBuilder = ContainerInfo.newBuilder();
    Job<BatchJobExt> job = JobGenerator.oneBatchJob();
    job = job.toBuilder()
            .withJobDescriptor(job.getJobDescriptor().toBuilder()
                    .withContainer(job.getJobDescriptor().getContainer().toBuilder()
                            .withAttributes(Collections.singletonMap(
                                    JobAttributes.JOB_CONTAINER_ATTRIBUTE_S3_BUCKET_NAME, "myOwnBucket"
                            )).build()
                    )
                    .build()
            )
            .build();
    converter.appendS3WriterRole(containerInfoBuilder, job, JobGenerator.oneBatchTask());
    assertThat(containerInfoBuilder.getPassthroughAttributesMap()).containsEntry(
            S3_WRITER_ROLE,
            job.getJobDescriptor().getContainer().getSecurityProfile().getIamRole()
    );
}