Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail with Robolectric 4.14 #102

Closed
Futsch1 opened this issue Nov 18, 2024 · 1 comment
Closed

Tests fail with Robolectric 4.14 #102

Futsch1 opened this issue Nov 18, 2024 · 1 comment

Comments

@Futsch1
Copy link

Futsch1 commented Nov 18, 2024

After upgrading to Robolectric 4.14, my tests are failing. See Futsch1/medTimer#331

Crashlog:

org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not execute test class 'com.futsch1.medtimer.ReminderWorkUnitTest'.
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:55)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:92)
	at jdk.proxy2/jdk.proxy2.$Proxy6.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:181)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:130)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:101)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:61)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:122)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.lang.NoClassDefFoundError: org/robolectric/ApkLoader
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
	at java.base/java.lang.Class.getConstructors(Class.java:2060)
	at org.robolectric.util.inject.Injector.findConstructor(Injector.java:271)
	at org.robolectric.util.inject.Injector.inject(Injector.java:252)
	at org.robolectric.util.inject.Injector.lambda$new$0(Injector.java:130)
	at org.robolectric.util.inject.Injector$MemoizingProvider.get(Injector.java:506)
	at org.robolectric.util.inject.Injector.getInstanceInternal(Injector.java:230)
	at org.robolectric.util.inject.Injector.resolveDependencies(Injector.java:305)
	at org.robolectric.util.inject.Injector.inject(Injector.java:257)
	at org.robolectric.util.inject.Injector.lambda$new$0(Injector.java:130)
	at org.robolectric.util.inject.Injector$MemoizingProvider.get(Injector.java:506)
	at org.robolectric.util.inject.Injector.getInstanceInternal(Injector.java:230)
	at org.robolectric.util.inject.Injector.getInstance(Injector.java:214)
	at org.robolectric.util.inject.Injector.getInstance(Injector.java:207)
	at org.robolectric.RobolectricTestRunner.<init>(RobolectricTestRunner.java:112)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunner.<init>(JUnit5RobolectricTestRunner.kt:27)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunner.<init>(JUnit5RobolectricTestRunner.kt:21)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunnerHelper.createTestEnvironmentForClass(JUnit5RobolectricTestRunnerHelper.kt:35)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunnerHelper.<init>(JUnit5RobolectricTestRunnerHelper.kt:19)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunnerHelper.<init>(JUnit5RobolectricTestRunnerHelper.kt)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunnerHelper$Companion.getInstance$robolectric_extension(JUnit5RobolectricTestRunnerHelper.kt:97)
	at tech.apter.junit.jupiter.robolectric.internal.RobolectricClassLoaderFactoryKt.robolectricClassLoaderFactory(RobolectricClassLoaderFactory.kt:17)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunnerHelper$Companion$setUp$2.invoke(JUnit5RobolectricTestRunnerHelper.kt:82)
	at tech.apter.junit.jupiter.robolectric.internal.JUnit5RobolectricTestRunnerHelper$Companion$setUp$2.invoke(JUnit5RobolectricTestRunnerHelper.kt:82)
	at tech.apter.junit.jupiter.robolectric.internal.RobolectricTestClassClassLoader.loadClass(RobolectricTestClassClassLoader.kt:29)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.loadClass(JUnitPlatformTestClassProcessor.java:173)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.access$100(JUnitPlatformTestClassProcessor.java:62)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.execute(JUnitPlatformTestClassProcessor.java:109)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.execute(JUnitPlatformTestClassProcessor.java:99)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:54)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:53)
	... 18 more
Caused by: java.lang.ClassNotFoundException: org.robolectric.ApkLoader
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 52 more
@warnyul
Copy link
Member

warnyul commented Nov 18, 2024

Support for Robolectric 4.14 was added in 0.9.0

@warnyul warnyul closed this as completed Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants