Skip to content

Instantly share code, notes, and snippets.

@christianb
Last active September 23, 2019 14:40
Show Gist options
  • Select an option

  • Save christianb/f6abb7f40a67ae196dd163bfa5b389a2 to your computer and use it in GitHub Desktop.

Select an option

Save christianb/f6abb7f40a67ae196dd163bfa5b389a2 to your computer and use it in GitHub Desktop.
How to unit testing runnable and handlers
every { handler.removeCallbacks(any()) } returns Unit
every { handler.postDelayed(any(), any()) } answers {
// capture runnable
(this.args[0] as Runnable).run()
true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment