Skip to content

Commit 05827ea

Browse files
committed
Avoid unsupported mock operation
Calling a real method on an interface is not supported by the Mockito version run by Gradle. #cherrypick PiperOrigin-RevId: 738358342 (cherry picked from commit d6b9988)
1 parent c558ae4 commit 05827ea

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

libraries/exoplayer_hls/src/test/java/androidx/media3/exoplayer/hls/HlsMediaPeriodTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public void getSteamKeys_isCompatibleWithHlsMultivariantPlaylistFilter() {
7575
FilterableManifestMediaPeriodFactory<HlsPlaylist> mediaPeriodFactory =
7676
(playlist, periodIndex) -> {
7777
HlsExtractorFactory mockHlsExtractorFactory = mock(HlsExtractorFactory.class);
78-
when(mockHlsExtractorFactory.getOutputTextFormat(any())).thenCallRealMethod();
78+
when(mockHlsExtractorFactory.getOutputTextFormat(any()))
79+
.then(invocation -> invocation.getArguments()[0]);
7980
HlsDataSourceFactory mockDataSourceFactory = mock(HlsDataSourceFactory.class);
8081
when(mockDataSourceFactory.createDataSource(anyInt())).thenReturn(mock(DataSource.class));
8182
HlsPlaylistTracker mockPlaylistTracker = mock(HlsPlaylistTracker.class);

libraries/exoplayer_smoothstreaming/src/test/java/androidx/media3/exoplayer/smoothstreaming/SsMediaPeriodTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public void getSteamKeys_isCompatibleWithSsManifestFilter() {
6666
createStreamElement(
6767
/* name= */ "text", C.TRACK_TYPE_TEXT, createTextFormat(/* language= */ "eng")));
6868
SsChunkSource.Factory chunkSourceFactory = mock(SsChunkSource.Factory.class);
69-
when(chunkSourceFactory.getOutputTextFormat(any())).thenCallRealMethod();
69+
when(chunkSourceFactory.getOutputTextFormat(any()))
70+
.then(invocation -> invocation.getArguments()[0]);
7071

7172
FilterableManifestMediaPeriodFactory<SsManifest> mediaPeriodFactory =
7273
(manifest, periodIndex) -> {

0 commit comments

Comments
 (0)