FirebaseToken mock implementation

239
May 03, 2018, at 05:48 AM

What is the easiest way to mock a FirebaseToken ,usually returned by the FirebaseAuth.getInstance().verifyIdTokenAsync(idToken) method. My authentication function calls this method and returns the FirebaseToken. I would like to test my authenticated route, but unfortunately FirebaseToken isn't an interface. I wonder why this design decision was taken.

The constructor of FirebaseToken takes a FirebaseTokenImpl which in turn takes Header header, Payload payload, byte[] signatureBytes, byte[] signedContentBytes. Payload is a static class with private fields.

I think the easiest option would be to map the FirebaseToken onto my own token representation class in the real authentication function, so that I can mock it easily in the overridden fake authenticator.

The second option, without any useless overhead, would be to find a way to instantiate a FirebaseToken. Unfortunately I need help with that. How do I create an instance of FirebaseToken with my chosen uid, mail etc?

Rent Charter Buses Company
READ ALSO
Alexa and Android

Alexa and Android

I am beginner in Android ProgrammingI wanted to do a simple java code where Alexa will send a message to my Android and my cell will show this message

209
How can I create a non-blocking GUI with cmd2 and wxPython?

How can I create a non-blocking GUI with cmd2 and wxPython?

I am creating a command-line interpreter in Python 3x using the cmd2 module

266
Notification doesn't appear when called but Shows after you close and Re-open Modal

Notification doesn't appear when called but Shows after you close and Re-open Modal

I designed a notification service in Angular 5 using ngrxThe Notification component works

35
Kill all running JavaScript functions on click

Kill all running JavaScript functions on click

I have a webpage with 3 buttons and a "result" section:

217