-
Notifications
You must be signed in to change notification settings - Fork 492
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
Final methods in TemplateEngine make it difficult to mock #314
Comments
I understand your point. Thymeleaf v3 will actually make most of its structures implement interfaces so that they are easier to test or mock (e.g. |
This is already so in Thymelaf 3.0, including an Already in `3.0.0-SNAPSHOT´ |
Over one year later, nothing has changed, 3.0 isn't out and we are still not able to mock Thymeleaf with Mockito. Why didn't you change the code? It's really easy and fast to do... |
If it's a blocker for you, you can use PowerMockito to mock final methods. |
A workaround is create a temporary interface and a related implementation:
Then, in the tested component instead of:
use:
Now, you can easily |
All the process(...) methods in TemplateEngine are marked as 'final'. This makes creating a Mockito mock object for it difficult. Please consider removing this keyword from methods in this class.
The text was updated successfully, but these errors were encountered: