@Test void fromShouldThrowWhenSecretKeyIsNull() { Configuration configuration = new PropertiesConfiguration(); configuration.addProperty(AwsS3ConfigurationReader.OBJECTSTORAGE_ENDPOINT, "myEndpoint"); configuration.addProperty(AwsS3ConfigurationReader.OBJECTSTORAGE_ACCESKEYID, "myAccessKeyId"); assertThatThrownBy(() -> AwsS3ConfigurationReader.from(configuration)) .isInstanceOf(NullPointerException.class) .hasMessage("'secretKey' is mandatory"); }
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);  }