@Test public void returnedValueIsCorrectTypeUsing2ArgConstructor() { when(envProvider.getEnv(HASHICORP_ROLE_ID)).thenReturn("role-id"); when(envProvider.getEnv(HASHICORP_SECRET_ID)).thenReturn("secret-id"); when(envProvider.getEnv(HASHICORP_TOKEN)).thenReturn("token"); KeyConfiguration keyConfiguration = mock(KeyConfiguration.class); when(config.getKeys()).thenReturn(keyConfiguration); DefaultKeyVaultConfig keyVaultConfig = mock(DefaultKeyVaultConfig.class); when(keyConfiguration.getKeyVaultConfig(KeyVaultType.HASHICORP)).thenReturn(Optional.of(keyVaultConfig)); when(keyVaultConfig.getProperty("url")).thenReturn(Optional.of("http: when(keyVaultConfig.getProperty("approlePath")).thenReturn(Optional.of("approle")); setUpUtilMocks(keyVaultConfig); KeyVaultService result = keyVaultServiceFactory.create(config, envProvider); assertThat(result).isInstanceOf(HashicorpKeyVaultService.class); }
@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();  }