Gradle plugin to be used in combination with the new unit testing feature of the Gradle Plugin / Android Studio to use real classes for e.g. SparseArray.
I noticed that the README of the unmock-plugin still references org.robolectric:android-all:4.3_r2-robolectric-0 (Oct 17, 2013) although newer versions are discussed in a few issues.
Current state
I am using umock-plugin 0.8.0 and robolectric 4.3_r2-robolectric-0.
Running the unit tests in the project via ./gradlew testDebugUnitTest :engelsystem:test testCcc37c3DebugUnitTest results in test failures, e.g.:
java.lang.NoClassDefFoundError: Could not initialize class android.os.Bundle
at androidx.core.os.BundleKt.bundleOf(Bundle.kt:34)
at nerd.tuxmobil.fahrplan.congress.extensions.IntentExtensionsKt.withExtras(IntentExtensions.kt:12)
...
Caused by:
java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchFieldError: mFlags [in thread "Test worker"]
at android.os.Bundle.<init>(Bundle.java:77)
at android.os.Bundle.<clinit>(Bundle.java:65)
at androidx.core.os.BundleKt.bundleOf(Bundle.kt:34)
at nerd.tuxmobil.fahrplan.congress.extensions.IntentExtensionsKt.withExtras(IntentExtensions.kt:12)
...
Context
org.robolectric:android-all
are available. Hence, I tried to upgrade.org.robolectric:android-all:4.3_r2-robolectric-0
(Oct 17, 2013) although newer versions are discussed in a few issues.Current state
I am using the following rules:
Target state
I am using the following rules having added a few to resolve errors:
Test failures
Running the unit tests in the project via
./gradlew testDebugUnitTest :engelsystem:test testCcc37c3DebugUnitTest
results in test failures, e.g.:See: IntentExtensionsKt.withExtras -> androidx.core.os.bundleOf
Related