I am running a development workflow for my Android project and executing unit test cases on release build variant.
All my test runs fine but few of roboelectric tests are failing.
Logs are as follows :
java.util.concurrent.RejectedExecutionException: Task org.robolectric.shadows.ShadowLegacyAsyncTask$3@3eb06764 rejected from java.util.concurrent.ThreadPoolExecutor@a3da6e8[Running, pool size = 5, active threads = 5, queued tasks = 128, completed tasks = 15]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
at org.robolectric.shadows.ShadowLegacyAsyncTask.executeOnExecutor(ShadowLegacyAsyncTask.java:123)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java)
at com.mindvalley.analytics.tracking.GetAdvertisingIdAsync.(GetAdvertisingIdAsync.kt:16)
at com.mindvalley.analytics.common.AnalyticsModule.initialize(AnalyticsModule.java:67)
at com.mindvalley.mva.controller.util.helpers.AnalyticsHelper.initialize(AnalyticsHelper.kt:62)
at com.mindvalley.mva.common.MVApplication.onCreate(MVApplication.kt:109)
at com.mindvalley.mva.common.MockApplication.onCreate(MockApplication.kt:12)
at org.robolectric.android.internal.AndroidTestEnvironment.lambda$installAndCreateApplication$0(AndroidTestEnvironment.java:276)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:75)
at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:276)
at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:169)
at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:301)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:243)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Command to run tests : ./gradlew testmvaReleaseUnitTest
Roboelectric test configuration :
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [Build.VERSION_CODES.O_MR1], manifest = Config.NONE, application = MockApplication::class)