EnvironmentVariableCredentialsProvider implements CredentialsProvider { @Override public Credentials getCredentials() { return credentials; } EnvironmentVariableCredentialsProvider();  EnvironmentVariableCredentialsProvider(String usernameKey, String passwordKey); @Override Credentials getCredentials(); @Override CredentialsProvider refresh();  }
@Test public void testDefaultConstructor() { CredentialsProvider provider = mockProvider(new EnvironmentVariableCredentialsProvider()); assert provider.getCredentials().isEqualTo(new Credentials(userName, userPassword)); }
@Test public void testConstructorWithParams() { CredentialsProvider provider = mockProvider(new EnvironmentVariableCredentialsProvider(userNameEnvProp, userPasswordEnvProp)); Credentials credentials = provider.getCredentials(); assert userName.equals(credentials.getUsername()); assert userPassword.equals(credentials.getPassword()); }