Description
Is your feature request related to a problem? Please describe.
When writing unit tests, there is a need to avoid outbound RPCs to another server. Today the Stripe API uses static methods and global (or request) config parameters, but there does not seem to be a way to mock the request/verify the request without running StripeMock, which is perhaps too large for a java unit test.
Describe the solution you'd like
If there was a constructor/factory based approach to constructing the stripe api, then we would be able to mock this away in our DI layer.
Today
Customer.create(customerCreateParamsObj);
Desirable alternatives
stripeFactoryObj.customerService().create(customerCreateParamsObj);
In my code I would likely provide CustomerService via DI, and then call like such:
customerService.create(customerCreateParamsObj);
This way I would be able to provide a Mockito implementation for CustomerService and setup mocks/verifications.
Describe alternatives you've considered
My solution until this is supported will be to wrap every Stripe API in a class/method and indirectly call the stripe API.
Alternatively it seems clients could use Mockito to mock static methods, though this approach is less desirable.
Additional context
No response