Skip to content

Instantly share code, notes, and snippets.

@kozmi55
Created October 17, 2017 20:04
Show Gist options
  • Save kozmi55/743b71b0517f738494ebf0aa3b5b4a45 to your computer and use it in GitHub Desktop.
Save kozmi55/743b71b0517f738494ebf0aa3b5b4a45 to your computer and use it in GitHub Desktop.
class FakeUserRepository : UserRepository {
override fun getUsers(page: Int, forced: Boolean): Single<UserListModel> {
val users = (1..10L).map {
val number = (page - 1) * 10 + it
User(it, "User $number", number * 100, "")
}
return Single.create<UserListModel> { emitter: SingleEmitter<UserListModel> ->
val userListModel = UserListModel(users)
emitter.onSuccess(userListModel)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment