How can I mock a c3p0 ComboPooledDataSource

535 views Asked by At

I understand that C3P0 is a final class, and cannot be mocked using Mockito. I also understand that I should not be mocking out my database calls in general. However, I have a few methods in a class that requires a C3P0 ComboPooledDataSource, and I would like to mock that cpds for testing those methods.

1

There are 1 answers

0
Maksym Prokhorenko On BEST ANSWER

Check the following approaches for the Mockito and PowerMock:

  1. Mockito v2.1.0
  2. PowerMock