Version
Media3 1.9.0
This jnm junit test fails when I update from 1.8.0 to 1.9.0:
import androidx.media3.exoplayer.ExoPlayer
import io.mockk.mockk
import org.junit.Test
/**
* Test to demonstrate MockK compatibility issue with Media3 1.9.0
*
* PASSES with Media3 1.8.0
* FAILS with Media3 1.9.0
*/
class MockKMedia3IssueTest {
@Test
fun testExoPlayerMocking() {
val mock = mockk<ExoPlayer>()
println("Mock created successfully: ${mock::class.java}")
}
}
The stack trace:
java.lang.ExceptionInInitializerError
at jdk.internal.reflect.GeneratedSerializationConstructorAccessor16.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
at io.mockk.proxy.jvm.ObjenesisInstantiator.instanceViaObjenesis(ObjenesisInstantiator.kt:76)
at io.mockk.proxy.jvm.ObjenesisInstantiator.instantiateViaProxy(ObjenesisInstantiator.kt:67)
at io.mockk.proxy.jvm.ObjenesisInstantiator.instance(ObjenesisInstantiator.kt:30)
at io.mockk.proxy.jvm.ProxyMaker.instantiate(ProxyMaker.kt:77)
at io.mockk.proxy.jvm.ProxyMaker.proxy(ProxyMaker.kt:46)
at io.mockk.impl.instantiation.JvmMockFactory.newProxy(JvmMockFactory.kt:34)
at io.mockk.impl.instantiation.AbstractMockFactory.newProxy$default(AbstractMockFactory.kt:24)
at io.mockk.impl.instantiation.AbstractMockFactory.mockk(AbstractMockFactory.kt:59)
at com.roku.mobile.videoplayer.impl.MockKMedia3IssueTest.testExoPlayerMocking(MockKMedia3IssueTest.kt:39)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "string" is null
at com.google.common.base.Ascii.toLowerCase(Ascii.java:409)
at androidx.media3.common.util.Util.isRunningOnEmulator(Util.java:474)
at androidx.media3.exoplayer.ExoPlayer.<clinit>(ExoPlayer.java:1283)
... 14 more
Devices that reproduce the issue
JVM Junit Tests
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Run the above test
Expected result
The test passes
Actual result
The test fails
Media
n/a
Bug Report
Version
Media3 1.9.0
This jnm junit test fails when I update from
1.8.0to1.9.0:The stack trace:
Devices that reproduce the issue
JVM Junit Tests
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Run the above test
Expected result
The test passes
Actual result
The test fails
Media
n/a
Bug Report
adb bugreportto android-media-github@google.com after filing this issue.