Skip to content

Instantly share code, notes, and snippets.

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