"Trying to call 'getOrThrow' on a failed channel result: Failed" when testing moleculeFlow with Turbine
See original GitHub issuePresenter:
@Composable fun PortfolioPresenter(): PortfolioModel {
var portfolioModel by remember { mutableStateOf<PortfolioModel>(PortfolioModel.Loading) }
LaunchedEffect("get-portfolio") {
portfolioModel = PortfolioModel.Error("Boom!")
}
return portfolioModel
}
Test:
class PortfolioPresenterTest {
@Test fun `loads portfolio`() = runBlocking {
makePresenter().test {
assertThat(awaitItem()).isEqualTo(PortfolioModel.Loading)
assertThat(awaitItem()).isEqualTo(PortfolioModel.Error("Boom!"))
}
}
private fun makePresenter(): Flow<PortfolioModel> {
return moleculeFlow(clock = Immediate) {
PortfolioPresenter()
}
}
}
The test fails with app.cash.turbine.AssertionError: Expected item but found Error(IllegalStateException)
, full stack trace below:
Stacktrace
Expected item but found Error(IllegalStateException)
app.cash.turbine.AssertionError: Expected item but found Error(IllegalStateException)
at app//app.cash.turbine.ChannelBasedFlowTurbine.unexpectedEvent(FlowTurbine.kt:353)
at app//app.cash.turbine.ChannelBasedFlowTurbine.awaitItem(FlowTurbine.kt:301)
at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1$1.invokeSuspend(PortfolioPresenterTest.kt:14)
at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1$1.invoke(PortfolioPresenterTest.kt)
at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1$1.invoke(PortfolioPresenterTest.kt)
at app//app.cash.turbine.FlowTurbineKt$test$4.invokeSuspend(FlowTurbine.kt:103)
at app//app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
at app//app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
at app//kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at app//kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at app//app.cash.turbine.FlowTurbineKt.test(FlowTurbine.kt:101)
at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1.invokeSuspend(PortfolioPresenterTest.kt:13)
at app//kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at app//kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at app//kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at app//kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at app//kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at app//kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at app//kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at app//kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at app//dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest.loads portfolio(PortfolioPresenterTest.kt:12)
at java.base@11.0.16/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base@11.0.16/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base@11.0.16/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@11.0.16/java.lang.reflect.Method.invoke(Method.java:566)
at app//org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at app//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at app//org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at app//org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at app//org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at app//org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at app//org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at app//org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at app//org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at app//org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at app//org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at app//org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at app//org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at app//org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at app//org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at java.base@11.0.16/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base@11.0.16/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base@11.0.16/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base@11.0.16/java.lang.reflect.Method.invoke(Method.java:566)
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:94)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
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.IllegalStateException: Trying to call 'getOrThrow' on a failed channel result: Failed
at kotlinx.coroutines.channels.ChannelResult.getOrThrow-impl(Channel.kt:443)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:68)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:64)
at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:164)
at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:163)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2158)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2404)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2585)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:247)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2547)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:620)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:786)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:105)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:456)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:425)
at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
at app.cash.molecule.GatedFrameClock.sendFrame(GatedFrameClock.kt:50)
at app.cash.molecule.GatedFrameClock.access$sendFrame(GatedFrameClock.kt:31)
at app.cash.molecule.GatedFrameClock$1.invokeSuspend(GatedFrameClock.kt:36)
(Coroutine boundary)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend(Recomposer.kt:425)
at androidx.compose.runtime.Recomposer$recompositionRunner$2$2.invokeSuspend(Recomposer.kt:682)
at androidx.compose.runtime.Recomposer$recompositionRunner$2.invokeSuspend(Recomposer.kt:681)
at app.cash.molecule.MoleculeKt$launchMolecule$2$1.invokeSuspend(molecule.kt:145)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invokeSuspend(molecule.kt:59)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invokeSuspend(FlowTurbine.kt:146)
Caused by: java.lang.IllegalStateException: Trying to call 'getOrThrow' on a failed channel result: Failed
at kotlinx.coroutines.channels.ChannelResult.getOrThrow-impl(Channel.kt:443)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:68)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1$1.invoke(molecule.kt:64)
at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:164)
at app.cash.molecule.MoleculeKt$launchMolecule$2$3.invoke(molecule.kt:163)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2158)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2404)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2585)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:247)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2547)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:620)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:786)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:105)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:456)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:425)
at androidx.compose.runtime.BroadcastFrameClock$FrameAwaiter.resume(BroadcastFrameClock.kt:42)
at androidx.compose.runtime.BroadcastFrameClock.sendFrame(BroadcastFrameClock.kt:71)
at app.cash.molecule.GatedFrameClock.sendFrame(GatedFrameClock.kt:50)
at app.cash.molecule.GatedFrameClock.access$sendFrame(GatedFrameClock.kt:31)
at app.cash.molecule.GatedFrameClock$1.invokeSuspend(GatedFrameClock.kt:36)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:245)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
at androidx.compose.runtime.Recomposer.invalidate$runtime_release(Recomposer.kt:895)
at androidx.compose.runtime.CompositionImpl.invalidate(Composition.kt:700)
at androidx.compose.runtime.RecomposeScopeImpl.invalidateForResult(RecomposeScopeImpl.kt:148)
at androidx.compose.runtime.CompositionImpl.addPendingInvalidationsLocked$invalidate(Composition.kt:552)
at androidx.compose.runtime.CompositionImpl.addPendingInvalidationsLocked(Composition.kt:567)
at androidx.compose.runtime.CompositionImpl.drainPendingModificationsLocked(Composition.kt:459)
at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:658)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:763)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:433)
at app.cash.molecule.MoleculeKt.launchMolecule(molecule.kt:163)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1.invokeSuspend(molecule.kt:64)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1.invoke(molecule.kt)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1$1.invoke(molecule.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1.invokeSuspend(molecule.kt:63)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1.invoke(molecule.kt)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1$1.invoke(molecule.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invokeSuspend(molecule.kt:59)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invoke(molecule.kt)
at app.cash.molecule.MoleculeKt$immediateClockFlow$1.invoke(molecule.kt)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invokeSuspend(FlowTurbine.kt:146)
at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invoke(FlowTurbine.kt)
at app.cash.turbine.FlowTurbineKt$collectTurbineIn$collectJob$1.invoke(FlowTurbine.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at app.cash.turbine.FlowTurbineKt.collectTurbineIn(FlowTurbine.kt:143)
at app.cash.turbine.FlowTurbineKt.access$collectTurbineIn(FlowTurbine.kt:1)
at app.cash.turbine.FlowTurbineKt$test$4.invokeSuspend(FlowTurbine.kt:102)
at app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
at app.cash.turbine.FlowTurbineKt$test$4.invoke(FlowTurbine.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at app.cash.turbine.FlowTurbineKt.test(FlowTurbine.kt:101)
at dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest$loads portfolio$1.invokeSuspend(PortfolioPresenterTest.kt:13)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at dev.egorand.moleculegetorthrowbug.PortfolioPresenterTest.loads portfolio(PortfolioPresenterTest.kt:12)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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:94)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Repro project: https://github.com/Egorand/molecule-get-or-throw-bug
To reproduce the issue, run ./gradlew app:testDebugUnitTest
.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Turbine is a small testing library for kotlinx.coroutines Flow
A small testing library for kotlinx.coroutines Flow - GitHub ... If await* is called and nothing happens, Turbine will timeout and fail instead...
Read more >mockk every {}.throws() Exception fails test - Stack Overflow
It will fail the test, if no exception is thrown. ... The unit test to verify the result when the following method is...
Read more >getOrThrow - Kotlin Programming Language
Returns the encapsulated value if this instance represents success or throws the encapsulated Throwable exception if it is failure.
Read more >Cashapp Molecule Issues - IssueHint
"Trying to call 'getOrThrow' on a failed channel result: Failed" when testing moleculeFlow with Turbine, closed, 6, 2022-07-31, 2022-11-28.
Read more >Build a StateFlow stream using Jetpack Compose
"Trying to call 'getOrThrow' on a failed channel result: Failed" when testing moleculeFlow with Turbine. Presenter:
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The fix is, instead of this:
…this:
🤦
The mystery deepens: repros for Turbine 0.8, but not Turbine 0.9 🤔