I have a process that runs in a Java Cloud Function and sends notifications to Firebase's FCM using the Firebase admin sdk.
I'm currently testing this with unit tests that mock FCM classes.
I'd like to add system-level tests that verify that the integration works correctly. Ideally, I'd like to execute the Cloud function and assert that FCM (or a mock service) receives a request with the expected content.
I've currently tried.
- Mocking FCM: Since the FCM client initializes with GOOGLE_APPLICATION_CREDENTIALS it doesn't seem to be possible to provide credentials such that the client sends the request to a mock service.
- Registering an Android Client and asserting on notification reception: It is quite cumbersome to setup and in some cases can take multiple minutes causing flakeyness.
- Using Firebase Local Emulator Suite: It doesn't appear to support FCM yet.
What would be the best way of doing this?