@Test public void exceptionThrownIfOnlySecretIdAuthEnvVarSet() { when(envProvider.getEnv(HASHICORP_ROLE_ID)).thenReturn(null); when(envProvider.getEnv(HASHICORP_SECRET_ID)).thenReturn("secret-id"); when(envProvider.getEnv(HASHICORP_TOKEN)).thenReturn(null); Throwable ex = catchThrowable(() -> keyVaultServiceFactory.create(config, envProvider)); assertThat(ex).isInstanceOf(HashicorpCredentialNotSetException.class); assertThat(ex).hasMessage(approleCredentialsExceptionMsg); }
@Override public KeyVaultService create(Config config, EnvironmentVariableProvider envProvider) { Objects.requireNonNull(config); Objects.requireNonNull(envProvider); HashicorpKeyVaultServiceFactoryUtil util = new HashicorpKeyVaultServiceFactoryUtil(); return this.create(config, envProvider, util); }
HashicorpKeyVaultServiceFactory implements KeyVaultServiceFactory { @Override public KeyVaultService create(Config config, EnvironmentVariableProvider envProvider) { Objects.requireNonNull(config); Objects.requireNonNull(envProvider); HashicorpKeyVaultServiceFactoryUtil util = new HashicorpKeyVaultServiceFactoryUtil(); return this.create(config, envProvider, util); } }
HashicorpKeyVaultServiceFactory implements KeyVaultServiceFactory { @Override public KeyVaultService create(Config config, EnvironmentVariableProvider envProvider) { Objects.requireNonNull(config); Objects.requireNonNull(envProvider); HashicorpKeyVaultServiceFactoryUtil util = new HashicorpKeyVaultServiceFactoryUtil(); return this.create(config, envProvider, util); }  }
HashicorpKeyVaultServiceFactory implements KeyVaultServiceFactory { @Override public KeyVaultService create(Config config, EnvironmentVariableProvider envProvider) { Objects.requireNonNull(config); Objects.requireNonNull(envProvider); HashicorpKeyVaultServiceFactoryUtil util = new HashicorpKeyVaultServiceFactoryUtil(); return this.create(config, envProvider, util); }  @Override KeyVaultService create(Config config, EnvironmentVariableProvider envProvider); @Override KeyVaultType getType(); }
HashicorpKeyVaultServiceFactory implements KeyVaultServiceFactory { @Override public KeyVaultService create(Config config, EnvironmentVariableProvider envProvider) { Objects.requireNonNull(config); Objects.requireNonNull(envProvider); HashicorpKeyVaultServiceFactoryUtil util = new HashicorpKeyVaultServiceFactoryUtil(); return this.create(config, envProvider, util); }  @Override KeyVaultService create(Config config, EnvironmentVariableProvider envProvider); @Override KeyVaultType getType();  }