Skip to content

Instantly share code, notes, and snippets.

@micHar
Last active June 20, 2022 14:48
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 micHar/53dbbad0ea524c394b6391bd9f8d102f to your computer and use it in GitHub Desktop.
Save micHar/53dbbad0ea524c394b6391bd9f8d102f to your computer and use it in GitHub Desktop.
@Test
fun `should not increase the playback counter until the sound has finished playing`() = runTest {
val soundPlayer = mockk<SoundPlayer>()
coEvery { soundPlayer.playSound() } coAnswers { delay(1000) }
val sut = MediaPlayer(this, soundPlayer)
sut.play()
advanceTimeBy(500)
sut.playbackCounter shouldBe 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment