Skip to content

BatchResponse implementation makes testing difficult. #388

Description

@ToxicBakery
  • Operating System version: N/A
  • Firebase SDK version: 2
  • Library version: 6.12.2
  • Firebase Product: Messaging

Description:

BatchResponse is implemented as a final class with a package-private constructor. As such, this means that as a consumer of the library I have to either wrap the response object or use reflection to make it testable.

Steps to reproduce:

// This will not compile
new BatchResponse(responses);

Suggestions

I would be happy to submit a PR for this but I would like guidance on implementation preference.

a) Remove the final keyword from the BatchResponse class so tools like Mockito can mock the class.
b) Make the constructor public
c) Add a builder or some other method of instantiating the class. This doesn't seem like a useful change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions