Skip to content

Commit 994e71c

Browse files
Extract similar usage of Resource.file.
1 parent c7f7a66 commit 994e71c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

testutil-gcloud/src/test/java/io/spine/testing/server/storage/datastore/TestDatastoresTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ void byResourceAtPath() {
105105
@Test
106106
@DisplayName("the service account resource")
107107
void byResource() {
108-
Resource serviceAccount = Resource.file(
109-
SPINE_DEV_JSON, TestDatastoresTest.class.getClassLoader()
110-
);
108+
Resource serviceAccount = localResource(SPINE_DEV_JSON);
111109
Datastore datastore = TestDatastores.remote(serviceAccount);
112110
String projectId = datastore.getOptions()
113111
.getProjectId();
@@ -118,9 +116,11 @@ void byResource() {
118116
@Test
119117
@DisplayName("throw an `ISE` when can't properly parse account credentials from resource")
120118
void throwOnInvalidResource() {
121-
Resource resource = Resource.file(
122-
"random.json", TestDatastoresTest.class.getClassLoader()
123-
);
119+
Resource resource = localResource("random.json");
124120
assertThrows(IllegalStateException.class, () -> TestDatastores.remote(resource));
125121
}
122+
123+
private static Resource localResource(String path) {
124+
return Resource.file(path, TestDatastoresTest.class.getClassLoader());
125+
}
126126
}

0 commit comments

Comments
 (0)