### Question:
GcpBackupUploader extends AbstractBackupUploader { public Credentials getCredential(String oauthScopes) throws IOException { validatePathParameter(oauthScopes, "oauthScopes"); GoogleCredentials credentials = GoogleCredentials.getApplicationDefault(); if (!oauthScopes.isBlank()) { credentials = credentials.createScoped(Arrays.asList(oauthScopes.split(","))); } return credentials; } GcpBackupUploader(String uploadFilePath, String gcpProjectId, Storage storage);  GcpBackupUploader(String uploadFilePath, String gcpProjectId, String oauthScopes); @Override void doWriteBackup(InputStream backupData, String uniqueFileName); @Override InputStream doReadBackup(String uniqueFileName); @Override void doRemoveBackup(String uniqueFileName); String getProjectId(); String getBucketName(); String getUploadFolder(); Credentials getCredential(String oauthScopes);  }### Answer:
@Test public void getCredential() throws IOException { gcpBackupUploader = new GcpBackupUploader(UPLOAD_PATH, GCP_PROJECT_ID, OAUTHSCOPES); Credentials creds = gcpBackupUploader.getCredential(OAUTHSCOPES); assertThat(creds).isInstanceOf(Credentials.class); assertThat(creds).isNotNull(); assertThat(creds.getAuthenticationType()).isEqualTo(AUTH_TYPE); }
@Test public void getCredential_Failed_OnEmptyEnv() throws IOException { exceptionRule.expect(IBackupUploader.BackupException.class); exceptionRule.expectMessage("oauthScopes is blank"); gcpBackupUploader.getCredential(""); }