Source:
public void setConfiugrationSetsValuesAsExpected() throws IOException { Configuration conf = new Configuration(); setConfigurationKey( conf, HadoopCredentialConfiguration.SA_CLIENT_EMAIL_SUFFIX, "anEmail"); setConfigurationKey( conf, HadoopCredentialConfiguration.SA_PRIVATE_KEY_ID_SUFFIX, "aPrivateKeyId"); setConfigurationKey( conf, HadoopCredentialConfiguration.SA_PRIVATE_KEY_SUFFIX, "aPrivateKey"); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_EMAIL_SUFFIX, "anEmail"); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_KEYFILE_SUFFIX, "aKeyFile"); setConfigurationKey( conf, HadoopCredentialConfiguration.JSON_KEYFILE_SUFFIX, "aJsonFile"); setConfigurationKey( conf, HadoopCredentialConfiguration.CLIENT_SECRET_SUFFIX, "aClientSecret"); setConfigurationKey( conf, HadoopCredentialConfiguration.CLIENT_ID_SUFFIX, "aClientId"); setConfigurationKey( conf, HadoopCredentialConfiguration.OAUTH_CLIENT_FILE_SUFFIX, "aClientOAuthFile"); setConfigurationKey( conf, HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX, "false"); setConfigurationKey( conf, HadoopCredentialConfiguration.ENABLE_NULL_CREDENTIAL_SUFFIX, "true"); CredentialConfiguration credentialConfiguration = HadoopCredentialConfiguration .newBuilder() .withConfiguration(conf) .build(); assertThat(credentialConfiguration.getSaClientEmail()).isEqualTo("anEmail"); assertThat(credentialConfiguration.getSaPrivateKeyId()).isEqualTo("aPrivateKeyId"); assertThat(credentialConfiguration.getSaPrivateKey()).isEqualTo("aPrivateKey"); assertThat(credentialConfiguration.getServiceAccountEmail()).isEqualTo("anEmail"); assertThat(credentialConfiguration.getServiceAccountKeyFile()).isEqualTo("aKeyFile"); assertThat(credentialConfiguration.getServiceAccountJsonKeyFile()).isEqualTo("aJsonFile"); assertThat(credentialConfiguration.getClientSecret()).isEqualTo("aClientSecret"); assertThat(credentialConfiguration.getClientId()).isEqualTo("aClientId"); assertThat(credentialConfiguration.getOAuthCredentialFile()).isEqualTo("aClientOAuthFile"); assertThat(credentialConfiguration.isServiceAccountEnabled()).isFalse(); assertThat(credentialConfiguration.isNullCredentialEnabled()).isTrue(); }

Target:
public void setConfiugrationSetsValuesAsExpected() throws IOException { Configuration conf = new Configuration(); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_CLIENT_EMAIL_SUFFIX, "anEmail"); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_PRIVATE_KEY_ID_SUFFIX, "aPrivateKeyId"); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_PRIVATE_KEY_SUFFIX, "aPrivateKey"); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_EMAIL_SUFFIX, "anEmail"); setConfigurationKey( conf, HadoopCredentialConfiguration.SERVICE_ACCOUNT_KEYFILE_SUFFIX, "aKeyFile"); setConfigurationKey( conf, HadoopCredentialConfiguration.JSON_KEYFILE_SUFFIX, "aJsonFile"); setConfigurationKey( conf, HadoopCredentialConfiguration.CLIENT_SECRET_SUFFIX, "aClientSecret"); setConfigurationKey( conf, HadoopCredentialConfiguration.CLIENT_ID_SUFFIX, "aClientId"); setConfigurationKey( conf, HadoopCredentialConfiguration.OAUTH_CLIENT_FILE_SUFFIX, "aClientOAuthFile"); setConfigurationKey( conf, HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX, "false"); setConfigurationKey( conf, HadoopCredentialConfiguration.ENABLE_NULL_CREDENTIAL_SUFFIX, "true"); CredentialConfiguration credentialConfiguration = HadoopCredentialConfiguration .newBuilder() .withConfiguration(conf) .build(); assertThat(credentialConfiguration.getServiceAccountClientEmail()).isEqualTo("anEmail"); assertThat(credentialConfiguration.getServiceAccountPrivateKeyId()).isEqualTo("aPrivateKeyId"); assertThat(credentialConfiguration.getServiceAccountPrivateKey()).isEqualTo("aPrivateKey"); assertThat(credentialConfiguration.getServiceAccountEmail()).isEqualTo("anEmail"); assertThat(credentialConfiguration.getServiceAccountKeyFile()).isEqualTo("aKeyFile"); assertThat(credentialConfiguration.getServiceAccountJsonKeyFile()).isEqualTo("aJsonFile"); assertThat(credentialConfiguration.getClientSecret()).isEqualTo("aClientSecret"); assertThat(credentialConfiguration.getClientId()).isEqualTo("aClientId"); assertThat(credentialConfiguration.getOAuthCredentialFile()).isEqualTo("aClientOAuthFile"); assertThat(credentialConfiguration.isServiceAccountEnabled()).isFalse(); assertThat(credentialConfiguration.isNullCredentialEnabled()).isTrue(); }