Created
June 21, 2022 07:00
-
-
Save micHar/1b3dc08ab94b2a5cabcb7c1b2e18f058 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OptIn(ExperimentalCoroutinesApi::class) | |
class NeverEndingCoroutineTest { | |
@Test | |
fun `should emit error when playSound throws`() = runTest { | |
val exception = Exception("Oopsie") | |
val soundPlayer = mockk<SoundPlayer>() | |
coEvery { soundPlayer.playSound() } throws exception | |
val sut = MediaPlayer(this, soundPlayer) | |
sut.playerErrors.test { | |
sut.play() | |
awaitItem() shouldBe exception | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment