Use runCatching
instead of try/catch
in PlayerExtensionsTest
PiperOrigin-RevId: 661992546
This commit is contained in:
parent
a76ff16179
commit
ef6cb5d913
@ -113,15 +113,14 @@ class PlayerExtensionsTest {
|
||||
fun playerListen_onEventsThrowsException_bubblesOutAndUnregistersListener() = runTest {
|
||||
val player = PlayerWithListeners(TestExoPlayerBuilder(context).build())
|
||||
val exceptionFromListen = async {
|
||||
try {
|
||||
player.listen { events ->
|
||||
if (Player.EVENT_VOLUME_CHANGED in events) {
|
||||
throw IllegalStateException("Volume event!")
|
||||
runCatching {
|
||||
player.listen { events ->
|
||||
if (Player.EVENT_VOLUME_CHANGED in events) {
|
||||
throw IllegalStateException("Volume event!")
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (expected: IllegalStateException) {
|
||||
expected
|
||||
}
|
||||
.exceptionOrNull()
|
||||
}
|
||||
// Wait for the Player.Listener to be registered inside player.listen
|
||||
testScheduler.runCurrent()
|
||||
|
Loading…
x
Reference in New Issue
Block a user