I have a question if I have an `attachView` and `d...
# mockk
j
I have a question if I have an
attachView
and
detachView
on my Presenter do I have to test these methods? Inside of the presenter I have the
loadData
and I have the unit tests for this
loadData
but then I have these methods and I don't know if I have to unit test those or not
r
@Joan Colmenero a good rule of thumb is to test all non private methods
When your unit test, your unit testing units of code in isolation
j
But makes sense to test attachView and detachView? Because I do not know how to do it though
r
as long as it doesn't have android code , and its public in your presenter, you should test it
j
How do I test attachView and detachView if I have no a getView? Then I have to create a getView method ?
r
What do these methods actually do?
j
Assign a View to a view from parameter
r
Than you pass a Mock of a view to the presenter
j
And the verify?
r
Assert that the actual equals Mock
and detach you assert that the actual equals null
or whatever the method does