Skip to content

Commit 6d38253

Browse files
author
Rachel Prince
committed
Update API and fix tests
1 parent 1fd59d1 commit 6d38253

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

firebase-appdistribution/api.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ package com.google.firebase.appdistribution {
3030
}
3131

3232
public enum FirebaseAppDistributionException.Status {
33-
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status APP_RUNNING_IN_PRODUCTION;
3433
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status AUTHENTICATION_CANCELED;
3534
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status AUTHENTICATION_FAILURE;
3635
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status DOWNLOAD_FAILURE;

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/ApkInstallerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void installActivityDestroyed_setsInstallError() {
8585

8686
assert ex instanceof FirebaseAppDistributionException;
8787
assertEquals(
88-
"The APK failed to install or installation was cancelled",
88+
FirebaseAppDistributionException.ErrorMessages.APK_INSTALLATION_FAILED,
8989
((FirebaseAppDistributionException) ex).getMessage());
9090
assertEquals(
9191
FirebaseAppDistributionException.Status.INSTALLATION_FAILURE,

firebase-appdistribution/src/test/java/com/google/firebase/appdistribution/FirebaseAppDistributionTesterApiClientTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ public void fetchNewRelease_whenConnectionFails_throwsError() throws Exception {
129129
TEST_FID_1, TEST_APP_ID_1, TEST_API_KEY, TEST_AUTH_TOKEN, applicationContext));
130130

131131
assertThat(ex.getErrorCode()).isEqualTo(Status.NETWORK_FAILURE);
132-
assertThat(ex.getMessage()).contains("Failed to fetch releases due to unknown network error");
132+
assertThat(ex.getMessage())
133+
.contains(FirebaseAppDistributionException.ErrorMessages.NETWORK_ERROR);
133134
assertThat(ex.getCause()).isEqualTo(caughtException);
134135
}
135136

@@ -146,7 +147,8 @@ public void fetchNewRelease_whenResponseFailsWith401_throwsError() throws Except
146147
TEST_FID_1, TEST_APP_ID_1, TEST_API_KEY, TEST_AUTH_TOKEN, applicationContext));
147148

148149
assertThat(ex.getErrorCode()).isEqualTo(Status.AUTHENTICATION_FAILURE);
149-
assertThat(ex.getMessage()).isEqualTo("Failed to authenticate the tester");
150+
assertThat(ex.getMessage())
151+
.isEqualTo(FirebaseAppDistributionException.ErrorMessages.AUTHENTICATION_ERROR);
150152
verify(mockHttpsURLConnection).disconnect();
151153
}
152154

@@ -163,7 +165,8 @@ public void fetchNewRelease_whenResponseFailsWith403_throwsError() throws Except
163165
TEST_FID_1, TEST_APP_ID_1, TEST_API_KEY, TEST_AUTH_TOKEN, applicationContext));
164166

165167
assertThat(ex.getErrorCode()).isEqualTo(Status.AUTHENTICATION_FAILURE);
166-
assertThat(ex.getMessage()).isEqualTo("Failed to authorize the tester");
168+
assertThat(ex.getMessage())
169+
.isEqualTo(FirebaseAppDistributionException.ErrorMessages.AUTHORIZATION_ERROR);
167170
verify(mockHttpsURLConnection).disconnect();
168171
}
169172

@@ -197,7 +200,8 @@ public void fetchNewRelease_whenResponseFailsWith504_throwsError() throws Except
197200
TEST_FID_1, TEST_APP_ID_1, TEST_API_KEY, TEST_AUTH_TOKEN, applicationContext));
198201

199202
assertThat(ex.getErrorCode()).isEqualTo(Status.NETWORK_FAILURE);
200-
assertThat(ex.getMessage()).isEqualTo("Failed to fetch releases due to timeout");
203+
assertThat(ex.getMessage())
204+
.isEqualTo(FirebaseAppDistributionException.ErrorMessages.TIMEOUT_ERROR);
201205
verify(mockHttpsURLConnection).disconnect();
202206
}
203207

@@ -232,7 +236,8 @@ public void fetchNewRelease_whenInvalidJson_throwsError() throws Exception {
232236
TEST_FID_1, TEST_APP_ID_1, TEST_API_KEY, TEST_AUTH_TOKEN, applicationContext));
233237

234238
assertThat(ex.getErrorCode()).isEqualTo(Status.UNKNOWN);
235-
assertThat(ex.getMessage()).isEqualTo("Error parsing service response");
239+
assertThat(ex.getMessage())
240+
.isEqualTo(FirebaseAppDistributionException.ErrorMessages.JSON_PARSING_ERROR);
236241
assertThat(ex.getCause()).isInstanceOf(JSONException.class);
237242
verify(mockHttpsURLConnection).disconnect();
238243
}

0 commit comments

Comments
 (0)