public <T extends S3ClientBuilder> void applyServiceConfigurations(T builder) {
    builder
        .dualstackEnabled(isDualStackEnabled)
        .serviceConfiguration(
            S3Configuration.builder()
                .pathStyleAccessEnabled(isPathStyleAccess)
                .useArnRegionEnabled(isUseArnRegionEnabled)
                .accelerateModeEnabled(isAccelerationEnabled)
                .build());
  }
@Test
  public void testApplyS3ServiceConfigurations() {
    Map<String, String> properties = Maps.newHashMap();
    properties.put(S3FileIOProperties.DUALSTACK_ENABLED, "true");
    properties.put(S3FileIOProperties.PATH_STYLE_ACCESS, "true");
    properties.put(S3FileIOProperties.USE_ARN_REGION_ENABLED, "true");
    // acceleration enabled has to be set to false if path style is true
    properties.put(S3FileIOProperties.ACCELERATION_ENABLED, "false");
    S3FileIOProperties s3FileIOProperties = new S3FileIOProperties(properties);
    S3ClientBuilder mockA = Mockito.mock(S3ClientBuilder.class);

    ArgumentCaptor<S3Configuration> s3ConfigurationCaptor =
        ArgumentCaptor.forClass(S3Configuration.class);

    Mockito.doReturn(mockA).when(mockA).dualstackEnabled(Mockito.anyBoolean());
    Mockito.doReturn(mockA).when(mockA).serviceConfiguration(Mockito.any(S3Configuration.class));

    s3FileIOProperties.applyServiceConfigurations(mockA);

    Mockito.verify(mockA).serviceConfiguration(s3ConfigurationCaptor.capture());

    S3Configuration s3Configuration = s3ConfigurationCaptor.getValue();
    assertThat(s3Configuration.pathStyleAccessEnabled())
        .as("s3 path style access enabled parameter should be set to true")
        .isTrue();
    assertThat(s3Configuration.useArnRegionEnabled())
        .as("s3 use arn region enabled parameter should be set to true")
        .isTrue();
    assertThat(s3Configuration.accelerateModeEnabled())
        .as("s3 acceleration mode enabled parameter should be set to true")
        .isFalse();
  }