Skip to content

Commit

Permalink
increasing coverage by adding another test
Browse files Browse the repository at this point in the history
Signed-off-by: fahadshamiinsta <[email protected]>
  • Loading branch information
fahadshamiinsta committed Jan 12, 2024
1 parent a631c9c commit 956a09e
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,19 @@ public void applicationDefaultCredentialThrowsErrorWhenNotAvailable() throws Exc
MatcherAssert.assertThat(exception.getMessage(), containsString("The Application Default Credentials are not available"));
}

/**
* The application default credential throws exception when it is
* used without GoogleCloudStorageService
* @throws Exception
*/
public void googleApplicationDefaultCredentialsThrowsExceptionWithoutGoogleCloudStorageService() throws Exception {
GoogleApplicationDefaultCredentials googleApplicationDefaultCredentials = new GoogleApplicationDefaultCredentials();
GoogleCredentials credentials = googleApplicationDefaultCredentials.get();
assertNull(credentials);
Exception exception = assertThrows(IOException.class, GoogleCredentials::getApplicationDefault);
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
Expand Down

0 comments on commit 956a09e

Please sign in to comment.