@@ -109,14 +109,16 @@ public void testSubscribeError() {
109
109
TestResponseInterceptor interceptor = new TestResponseInterceptor ();
110
110
InstanceIdClient client = initInstanceIdClient (response , interceptor );
111
111
112
+ String content = "{\" error\" : \" ErrorCode\" }" ;
112
113
for (int statusCode : HTTP_ERRORS ) {
113
- response .setStatusCode (statusCode ).setContent ("{ \" error \" : \" test error \" }" );
114
+ response .setStatusCode (statusCode ).setContent (content );
114
115
115
116
try {
116
117
client .subscribeToTopic ("test-topic" , ImmutableList .of ("id1" , "id2" ));
117
118
fail ("No error thrown for HTTP error" );
118
119
} catch (FirebaseMessagingException error ) {
119
- checkExceptionFromHttpResponse (error , statusCode , "test error" );
120
+ String expectedMessage = "Error while calling the IID service: ErrorCode" ;
121
+ checkExceptionFromHttpResponse (error , statusCode , expectedMessage );
120
122
}
121
123
122
124
checkTopicManagementRequestHeader (interceptor .getLastRequest (), TEST_IID_SUBSCRIBE_URL );
@@ -247,14 +249,16 @@ public void testUnsubscribeError() {
247
249
TestResponseInterceptor interceptor = new TestResponseInterceptor ();
248
250
InstanceIdClient client = initInstanceIdClient (response , interceptor );
249
251
252
+ String content = "{\" error\" : \" ErrorCode\" }" ;
250
253
for (int statusCode : HTTP_ERRORS ) {
251
- response .setStatusCode (statusCode ).setContent ("{ \" error \" : \" test error \" }" );
254
+ response .setStatusCode (statusCode ).setContent (content );
252
255
253
256
try {
254
257
client .unsubscribeFromTopic ("test-topic" , ImmutableList .of ("id1" , "id2" ));
255
258
fail ("No error thrown for HTTP error" );
256
259
} catch (FirebaseMessagingException error ) {
257
- checkExceptionFromHttpResponse (error , statusCode , "test error" );
260
+ String expectedMessage = "Error while calling the IID service: ErrorCode" ;
261
+ checkExceptionFromHttpResponse (error , statusCode , expectedMessage );
258
262
}
259
263
260
264
checkTopicManagementRequestHeader (interceptor .getLastRequest (), TEST_IID_UNSUBSCRIBE_URL );
0 commit comments