Skip to content

Commit 540d4b2

Browse files
committed
Minor code and test cleanup
1 parent 157e693 commit 540d4b2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/main/java/com/google/firebase/projectmanagement/FirebaseProjectManagementServiceImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,6 @@ protected String execute() throws FirebaseProjectManagementException {
334334
};
335335
}
336336

337-
private String buildMessage(String resourceId, String resourceIdName, String description) {
338-
return String.format("%s \"%s\": %s", resourceIdName, resourceId, description);
339-
}
340-
341337
private String pollOperation(String projectId, String operationName)
342338
throws FirebaseProjectManagementException {
343339
String url = String.format("%s/v1/%s", FIREBASE_PROJECT_MANAGEMENT_URL, operationName);
@@ -784,6 +780,10 @@ private void sleepOrThrow(String projectId, long delayMillis)
784780
}
785781
}
786782

783+
private String buildMessage(String resourceId, String resourceIdName, String description) {
784+
return String.format("%s \"%s\": %s", resourceIdName, resourceId, description);
785+
}
786+
787787
/* Helper types. */
788788

789789
private interface CreateAppFromAppIdFunction<T> extends ApiFunction<String, T> {}

src/test/java/com/google/firebase/projectmanagement/FirebaseProjectManagementServiceImplTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.google.firebase.TestOnlyImplFirebaseTrampolines;
4848
import com.google.firebase.auth.MockGoogleCredentials;
4949
import com.google.firebase.internal.TestApiClientUtils;
50+
import com.google.firebase.internal.SdkUtils;
5051
import com.google.firebase.testing.MultiRequestMockHttpTransport;
5152
import com.google.firebase.testing.TestUtils;
5253
import java.io.ByteArrayOutputStream;
@@ -72,6 +73,7 @@ public class FirebaseProjectManagementServiceImplTest {
7273
private static final String IOS_APP_ID = "test-ios-app-id";
7374
private static final String IOS_APP_RESOURCE_NAME = "ios/11111";
7475
private static final String ANDROID_APP_RESOURCE_NAME = "android/11111";
76+
private static final String CLIENT_VERSION = "Java/Admin/" + SdkUtils.getVersion();
7577
private static final IosAppMetadata IOS_APP_METADATA =
7678
new IosAppMetadata(IOS_APP_RESOURCE_NAME, IOS_APP_ID, DISPLAY_NAME, PROJECT_ID, BUNDLE_ID);
7779
private static final AndroidAppMetadata ANDROID_APP_METADATA =
@@ -1104,7 +1106,7 @@ private static FirebaseProjectManagementServiceImpl initServiceImplWithFaultyTra
11041106
.setHttpTransport(TestUtils.createFaultyHttpTransport())
11051107
.build();
11061108
FirebaseApp app = FirebaseApp.initializeApp(options);
1107-
return new FirebaseProjectManagementServiceImpl(app, new MockSleeper(), new MockScheduler());
1109+
return new FirebaseProjectManagementServiceImpl(app);
11081110
}
11091111

11101112
private void checkRequestHeader(String expectedUrl, HttpMethod httpMethod) {
@@ -1119,6 +1121,7 @@ private void checkRequestHeader(int index, String expectedUrl, HttpMethod httpMe
11191121
assertEquals(httpMethod.name(), request.getRequestMethod());
11201122
assertEquals(expectedUrl, request.getUrl().toString());
11211123
assertEquals("Bearer test-token", request.getHeaders().getAuthorization());
1124+
assertEquals(CLIENT_VERSION, request.getHeaders().get("X-Client-Version"));
11221125
}
11231126

11241127
private void checkRequestPayload(Map<String, String> expected) throws IOException {

0 commit comments

Comments
 (0)