-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BatchResponse implementation makes testing difficult. #388
Comments
Our typical response for this sort of requests is asking developers to not depend directly on the SDK interfaces (this is a general best practice when consuming any third party library/API). Instead define your own interfaces, and implement your logic and tests around those interfaces. I suppose this is what you refer to as "wrapping".
If we must make a change in the SDK to make this a bit easier, how about we turn |
Based on other interfaces and concrete implementations, I moved the implementation to |
Could this be done for the nested class "SendResponse" as well? |
This would greatly benefit testing. I currently need to integrate PowerMock just so I can Mock SendResponse. |
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:
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.
The text was updated successfully, but these errors were encountered: