Skip to content
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

Make method calls non-static #93

Closed
benmccann opened this issue Aug 6, 2014 · 5 comments
Closed

Make method calls non-static #93

benmccann opened this issue Aug 6, 2014 · 5 comments

Comments

@benmccann
Copy link

The fact that the API is all static makes it hard to inject mocks for testing our application

@kyleconroy
Copy link
Contributor

Yep, this is a known limitation of the current API. However, there aren't any plans right now for a major rewrite. Thanks for the report!

@chrylis
Copy link

chrylis commented Mar 30, 2015

+1 for a cleaner 2.0. The static setup like this is routine in JavaScript, but it causes no end of headaches (container management, configuration, testing) in Java.

@pandacalculus
Copy link
Contributor

+1 - we've also hit this when attempting to write tests that mock out the actual calls to Stripe. Have to jump thru some ugly hoops to get the job done.

@lnhrdt
Copy link

lnhrdt commented Oct 10, 2016

+1 to echo everyone else. It's a difficult API to have to work with in a TDD environment.

@kyleconroy 2 years later has the team's stance on this changed?

@ghost
Copy link

ghost commented Dec 7, 2017

To anyone coming across this when searching for a solution, you can mock a request by doing:
StripeResponseGetter stripeMock = mock(StripeResponseGetter.class); APIResource.setStripeResponseGetter(stripeMock);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants