@Test void fromShouldWork() { Configuration configuration = new PropertiesConfiguration(); URI endpoint = URI.create("http: configuration.addProperty(AwsS3ConfigurationReader.OBJECTSTORAGE_ENDPOINT, endpoint); String accessKeyId = "myAccessKeyId"; configuration.addProperty(AwsS3ConfigurationReader.OBJECTSTORAGE_ACCESKEYID, accessKeyId); String secretKey = "mySecretKey"; configuration.addProperty(AwsS3ConfigurationReader.OBJECTSTORAGE_SECRETKEY, secretKey); AwsS3AuthConfiguration expected = AwsS3AuthConfiguration.builder() .endpoint(endpoint) .accessKeyId(accessKeyId) .secretKey(secretKey) .build(); AwsS3AuthConfiguration authConfiguration = AwsS3ConfigurationReader.from(configuration); assertThat(authConfiguration).isEqualTo(expected); }
public static AwsS3AuthConfiguration from(Configuration configuration) { String endpoint = configuration.getString(OBJECTSTORAGE_ENDPOINT); if (StringUtils.isEmpty(endpoint)) { throw new NullPointerException("'endpoint' is mandatory"); } return AwsS3AuthConfiguration.builder() .endpoint(URI.create(endpoint)) .accessKeyId(configuration.getString(OBJECTSTORAGE_ACCESKEYID)) .secretKey(configuration.getString(OBJECTSTORAGE_SECRETKEY)) .build(); }
AwsS3ConfigurationReader { public static AwsS3AuthConfiguration from(Configuration configuration) { String endpoint = configuration.getString(OBJECTSTORAGE_ENDPOINT); if (StringUtils.isEmpty(endpoint)) { throw new NullPointerException("'endpoint' is mandatory"); } return AwsS3AuthConfiguration.builder() .endpoint(URI.create(endpoint)) .accessKeyId(configuration.getString(OBJECTSTORAGE_ACCESKEYID)) .secretKey(configuration.getString(OBJECTSTORAGE_SECRETKEY)) .build(); } }
AwsS3ConfigurationReader { public static AwsS3AuthConfiguration from(Configuration configuration) { String endpoint = configuration.getString(OBJECTSTORAGE_ENDPOINT); if (StringUtils.isEmpty(endpoint)) { throw new NullPointerException("'endpoint' is mandatory"); } return AwsS3AuthConfiguration.builder() .endpoint(URI.create(endpoint)) .accessKeyId(configuration.getString(OBJECTSTORAGE_ACCESKEYID)) .secretKey(configuration.getString(OBJECTSTORAGE_SECRETKEY)) .build(); }  }
AwsS3ConfigurationReader { public static AwsS3AuthConfiguration from(Configuration configuration) { String endpoint = configuration.getString(OBJECTSTORAGE_ENDPOINT); if (StringUtils.isEmpty(endpoint)) { throw new NullPointerException("'endpoint' is mandatory"); } return AwsS3AuthConfiguration.builder() .endpoint(URI.create(endpoint)) .accessKeyId(configuration.getString(OBJECTSTORAGE_ACCESKEYID)) .secretKey(configuration.getString(OBJECTSTORAGE_SECRETKEY)) .build(); }  static AwsS3AuthConfiguration from(Configuration configuration); }
AwsS3ConfigurationReader { public static AwsS3AuthConfiguration from(Configuration configuration) { String endpoint = configuration.getString(OBJECTSTORAGE_ENDPOINT); if (StringUtils.isEmpty(endpoint)) { throw new NullPointerException("'endpoint' is mandatory"); } return AwsS3AuthConfiguration.builder() .endpoint(URI.create(endpoint)) .accessKeyId(configuration.getString(OBJECTSTORAGE_ACCESKEYID)) .secretKey(configuration.getString(OBJECTSTORAGE_SECRETKEY)) .build(); }  static AwsS3AuthConfiguration from(Configuration configuration);  }