Created
March 22, 2020 17:09
-
-
Save mcatta/5511bfa835e98e9556003f74caefb79c to your computer and use it in GitHub Desktop.
Mock static class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainPresenter( | |
private val view: MainContract.View, | |
private val dataRepository: DataRepository | |
) : MainContract.Presenter { | |
override fun fetchData() { | |
try { | |
val result = dataRepository.fetchData() | |
view.onResult(result.map { | |
UiDataModel( | |
MyUselessUtils.generateUUID(), | |
it.id, | |
it.value | |
) | |
}) | |
} catch (err: Throwable) { | |
view.onError(err) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment