Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit b0c1514

Browse files
committed
change to use resource as stream
# Conflicts: # google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITMutableCredentialsTest.java
1 parent 80b67bf commit b0c1514

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITMutableCredentialsTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import com.google.spanner.admin.database.v1.DatabaseName;
3030
import java.io.IOException;
3131
import java.io.InputStream;
32-
import java.nio.file.Files;
33-
import java.nio.file.Paths;
3432
import java.util.ArrayList;
3533
import java.util.List;
3634
import org.junit.Test;
@@ -51,7 +49,8 @@ public class ITMutableCredentialsTest extends ITAbstractSpannerTest {
5149
public void testMutableCredentialsUpdateAuthorizationForRunningClient() throws IOException {
5250

5351
GoogleCredentials credentialsFromFile;
54-
try (InputStream stream = Files.newInputStream(Paths.get(VALID_KEY_RESOURCE))) {
52+
try (InputStream stream = ITMutableCredentialsTest.class.getResourceAsStream(VALID_KEY_RESOURCE)) {
53+
assertNotNull("Missing test resource: " + VALID_KEY_RESOURCE, stream);
5554
credentialsFromFile = GoogleCredentials.fromStream(stream);
5655
}
5756
assumeTrue(
@@ -60,7 +59,7 @@ public void testMutableCredentialsUpdateAuthorizationForRunningClient() throws I
6059

6160
ServiceAccountCredentials validCredentials = (ServiceAccountCredentials) credentialsFromFile;
6261
ServiceAccountCredentials invalidCredentials;
63-
try (InputStream stream = Files.newInputStream(Paths.get(INVALID_KEY_RESOURCE))) {
62+
try (InputStream stream = ITMutableCredentialsTest.class.getResourceAsStream(INVALID_KEY_RESOURCE)) {
6463
assertNotNull("Missing test resource: " + INVALID_KEY_RESOURCE, stream);
6564
invalidCredentials = ServiceAccountCredentials.fromStream(stream);
6665
}

0 commit comments

Comments
 (0)