Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created March 22, 2020 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcatta/5511bfa835e98e9556003f74caefb79c to your computer and use it in GitHub Desktop.
Save mcatta/5511bfa835e98e9556003f74caefb79c to your computer and use it in GitHub Desktop.
Mock static class
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