-
Notifications
You must be signed in to change notification settings - Fork 83
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
Cannot mock Matcher #116
Comments
Can you provide example why you want to mock |
Because I am building code arround the matcher and I need to test what happend when matcher failed or succeded. I could write some fake data but that sould not concerne my test. And your code is used as a service and therefore could be mock. |
I think in this case we can remove final statement from Matcher |
Still not sure is that a good way to use it. I use BTW. Adding uuid pattern for |
Yes it work too. It seems to me like adding another layer of abstraction only for mocking. Not very fan of this solution, but it does not require to fork the all project, which is a plus. I use this pattern in unit test of api with hateos implementation. Wich has a lot a autoreferencing link, with obviously a lot of uuid. |
@norzechowicz would you remove final statement from Matcher? |
I’m not sure, this final statement is so meaningless and creatig abstraction just to mock Matcher, sounds a bit like overengeneerig something simple. I would say, lets remove it |
Before you do anything, removing the final statement is not enough to allow mocking, I had to do some other minor fix. You can have a lot at what I have on my fork. (From memory I have also hadded an interface and make the factory return the interface) For the exact use case here how Create my mock.
Also one last thing, I have written the first version of this mock of your service montg ago, the issue only occured recently when you changed the interface. edit : after reflexion, removing the final keywork is not necessary if you had an interface, because I mock the interface and not the matcher itself, wich is way cleaner. |
I need to mock the main Matcher class which is marked as final.
In order to do it I have made a fork and create an interface for matcher.
The text was updated successfully, but these errors were encountered: