Unit Testing Presenters in Mortar
Mortar is another great library made by Square. It is however not easy to use due to the lack of documentation. The issue on “Unit Testing presenters” is closed but without giving a clear approach. I’ve figured out a really simple way to do the job and like to share.
Here’s how to mock the MortarScope:
And here’s how to unit test the presenter:
The full code of the sample project is available on Github.