Skip to content

Commit

Permalink
Add Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
StaehliJ committed Jan 20, 2025
1 parent e4e435a commit 5c29aa1
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import ch.srgssr.pillarbox.player.tracker.FakeMediaItemTracker
import ch.srgssr.pillarbox.player.tracker.MediaItemTrackerData
import ch.srgssr.pillarbox.player.tracker.MutableMediaItemTrackerData
import io.mockk.clearAllMocks
import io.mockk.confirmVerified
import io.mockk.mockk
import io.mockk.verify
import org.junit.runner.RunWith
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
Expand Down Expand Up @@ -97,6 +99,19 @@ class PillarboxMediaPeriodTest {
assertEquals(expectedTrackGroup, mediaPeriod.trackGroups)
}

@Test
fun `test MediaPeriod Callback is forwarded`() {
val mediaPeriod = PillarboxMediaPeriod(mediaPeriod = mediaPeriod, emptyTrackerData, emptyList())
val callback = mockk<MediaPeriod.Callback>(relaxed = true)
mediaPeriod.prepare(callback, 0)

verify {
callback.onPrepared(mediaPeriod)
}

confirmVerified(callback)
}

private companion object {
private val blockedTimeRanges = listOf(BlockedTimeRange(0L, 100L), BlockedTimeRange(200L, 300L))
private val emptyTrackerData = MediaItemTrackerData(MutableMediaItemTrackerData.EMPTY)
Expand Down

0 comments on commit 5c29aa1

Please sign in to comment.