Testing processor

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing processor

fsimard
Hi

For my project i write a couple of processor to meet my needs.

Do you know a good way to test my processor with mockito.
I have some difficulty mocking class of the framework because they are Final.

Reply | Threaded
Open this post in threaded view
|

Re: Testing processor

sergey
Yes it is tricky but possible.

http://code.google.com/p/powermock/
Reply | Threaded
Open this post in threaded view
|

Re: Testing processor

Zemi
Administrator
For integration testing, you could instance a whole TemplateEngine, see an example (lines 19-26).

For unit testing, best option is moving all logic out to another class, like in this Processor (line 31).

Reply | Threaded
Open this post in threaded view
|

Re: Testing processor

fsimard
In reply to this post by fsimard
Tks for the comment.

After checking the code of thymeleaf. I use the same method as M. Fernandez to test my processor

I copy the code of AbstractDocumentProcessingTest and made some modification to add a new dialect.

A create a test similar to TagRemovalTest

I cant get a coverage of 100% but i am pretty close.

Francis