AwsCliConfigProfileCredentialsProvider implements AWSCredentialsProvider { @Override public AWSCredentials getCredentials() { if (cliConfigFile == null) { cliConfigFile = new AwsCliConfigFile(); lastRefreshed = System.nanoTime(); } long now = System.nanoTime(); long age = now - lastRefreshed; if (age > awsCliConfigRefreshForceIntervalNanos) { refresh(); } else if (age > awsCliConfigRefreshIntervalNanos) { if (refreshSemaphore.tryAcquire()) { try { refresh(); } finally { refreshSemaphore.release(); } } } AWSCredentialsProvider cp = cliConfigFile.getCredentialsProvider(profileName); if (cp != null) { return cp.getCredentials(); } return null; } AwsCliConfigProfileCredentialsProvider();  AwsCliConfigProfileCredentialsProvider(String profileName);  AwsCliConfigProfileCredentialsProvider(String cliConfigFilePath, String profileName);  AwsCliConfigProfileCredentialsProvider(AwsCliConfigFile cliConfigFile,
			String profileName); @Override AWSCredentials getCredentials(); @Override void refresh();  }
@Test public void test() { AWSCredentials expectedAwsCredentials = mock(AWSCredentials.class); when(cp.getCredentials()).thenReturn(expectedAwsCredentials); AWSCredentials actual = sut.getCredentials(); assertThat(actual, is(expectedAwsCredentials)); logger.info("{}", actual); }