I have a question if I have an `attachView` and `d...
# test
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 And then I have a repository that does this
Copy code
class CryptoListRepositoryImpl(var cryptoCurrencyService: CryptoCurrencyService) : CryptoListRepository {
    override fun getResultData(): Single<CryptoResponse> {
        return cryptoCurrencyService.getCryptoCurrency()
    }
}
do I have to unit test this
getResultData()
? (edited) And then an use case
Copy code
class GetCryptoListUseCase @Inject constructor(var cryptoListRepository: CryptoListRepository) {
    fun execute(): Single<List<CryptoViewModel>> {
        return cryptoListRepository.getResultData().map {
            cryptoCurrencyMapper(
                it
            )
        }
    }
}
I have to Unit test the
mapper
and the use case
execute()
?
t
It’s definitely an opinion - but if it were me, as long as I had an acceptance test somewhere covering this flow, I definitely wouldn’t unit test the code you’ve presented
You didn’t show your
cryptoCurrencyMapper
so I can’t comment on that
j
No because I know I have to, I mean I did a test for the mapper, but my real question is, do I have to test the view stuff? I mean showProgressBar, attachView, dettachView, etc..?
t
I don’t do Android so can’t help you there