Skip to content

Commit

Permalink
added a comment to test helper method
Browse files Browse the repository at this point in the history
Signed-off-by: fahadshamiinsta <fshami@netapp.com>
  • Loading branch information
fahadshamiinsta committed Jan 11, 2024
1 parent 6fb32ef commit 79dc8f0
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,12 @@ public void testToTimeout() {
assertEquals(0, GoogleCloudStorageService.toTimeout(TimeValue.MINUS_ONE).intValue());
}

/*
The following method test the Google Application Default Credential instead of
using service account file.
Considered use of Junit Mocking due to static method GoogleCredentials.getApplicationDefault
and avoiding environment variables to set which later use GCE.
/**
* The following method test the Google Application Default Credential instead of
* using service account file.
* Considered use of JUnit Mocking due to static method GoogleCredentials.getApplicationDefault
* and avoiding environment variables to set which later use GCE.
* @throws Exception
*/
public void testApplicationDefaultCredential() throws Exception {
GoogleCloudStorageClientSettings settings = getGCSClientSettingsWithoutCredentials();
Expand Down Expand Up @@ -244,6 +245,11 @@ public void applicationDefaultCredentialThrowsErrorWhenNotAvailable() throws Exc
MatcherAssert.assertThat(exception.getMessage(), containsString("The Application Default Credentials are not available"));
}

/**
* This is a helper method to provide GCS Client settings without credentials
* @return
* @throws URISyntaxException
*/
private GoogleCloudStorageClientSettings getGCSClientSettingsWithoutCredentials() throws URISyntaxException {
return new GoogleCloudStorageClientSettings(
null,
Expand Down

0 comments on commit 79dc8f0

Please sign in to comment.