Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Relax typing for the mocking result #229
The typing to create a mock is
There are two solutions:
The drawbacks are that is requires the creation of an anonymous inner class every time. And it means a new set of
The drawbacks are that in rare cases the inference won't work. Explicit typing will be required. And it means you can do
I prefer number 2. It requires a typing change and that's it. Inference issues are pretty rare. The only current problem is with partial mocks. So they will keep the current typing but it might change if I find the right way to do it. Mocking the wrong type doesn't matter. It will throw an exception at the first execution.