https://kotlinlang.org logo
#compose
Title
# compose
g

galex

08/05/2020, 5:41 AM
What is wrong with this test?
Copy code
@MediumTest
@RunWith(JUnit4::class)
class CalculatorOutputRowTest {

    @get:Rule
    val composeTestRule = createComposeRule()

    @Before
    fun setup() {
        composeTestRule.setContent {
            MaterialTheme {
                Surface {

                    val calculatorState = CalculatorState().apply {
                        numberOfBalls = 4
                        weightPerBall = 280
                        saltPercentage = 0.03f
                        waterPercentage = 0.65f
                    }

                    CalculatorScreen(calculatorState, showSignIn = {})
                }
            }
        }
    }

    @Test
    fun testFlourValue() {

        //InstrumentationRegistry.getInstrumentation().context

        findByTag("flour").assertIsDisplayed()
    }
}
I get the following error running
testFlourValue()
:
Copy code
java.lang.NoSuchMethodError: No virtual method startRestartGroup(ILjava/lang/String;)V in class Landroidx/compose/Composer; or its super classes (declaration of 'androidx.compose.Composer' appears in /data/app/il.co.galex.alexpizzapp.test-bjaDLvHLoWZtKWX3_CsySw==/base.apk)
	at androidx.compose.internal.ComposableLambda.invoke(ComposableLambda.kt:140)
	at androidx.compose.internal.ComposableLambda.invoke(Unknown Source:17)
	at androidx.ui.core.selection.SelectionContainerKt$SelectionContainer$3$1.invoke(SelectionContainer.kt:96)
	at androidx.ui.core.selection.SelectionContainerKt$SelectionContainer$3$1.invoke(Unknown Source:14)
	at androidx.compose.internal.RestartableFunction.invoke(RestartableFunction.kt:142)
	at androidx.compose.internal.RestartableFunction.invoke(Unknown Source:14)
	at androidx.ui.core.LayoutKt.Layout(Layout.kt:168)
	at androidx.ui.core.LayoutKt.Layout(Layout.kt:158)
	at androidx.ui.core.selection.SelectionContainerKt.Wrap(SelectionContainer.kt:146)
	at androidx.ui.core.selection.SelectionContainerKt.access$Wrap(Unknown Source:0)
	at androidx.ui.core.selection.SelectionContainerKt$SelectionContainer$3.invoke(SelectionContainer.kt:95)
	at androidx.ui.core.selection.SelectionContainerKt$SelectionContainer$3.invoke(Unknown Source:14)
	at androidx.compose.internal.RestartableFunction.invoke(RestartableFunction.kt:142)
	at androidx.compose.internal.RestartableFunction.invoke(Unknown Source:14)
	at androidx.compose.AmbientKt.Providers(Ambient.kt:170)
	at androidx.ui.core.selection.SelectionContainerKt.SelectionContainer(SelectionContainer.kt:92)
	at androidx.ui.core.selection.SelectionContainerKt.SelectionContainer(SelectionContainer.kt:51)
	at androidx.ui.core.WrappedComposition$setContent$1$1$2.invoke(Wrapper.kt:310)
	at androidx.ui.core.WrappedComposition$setContent$1$1$2.invoke(Unknown Source:14)
	at androidx.compose.internal.RestartableFunction.invoke(RestartableFunction.kt:142)
	at androidx.compose.internal.RestartableFunction.invoke(Unknown Source:14)
	at androidx.compose.AmbientKt.Providers(Ambient.kt:170)
	at androidx.ui.core.AmbientsKt.ProvideCommonAmbients(Ambients.kt:115)
	at androidx.ui.core.AndroidAmbientsKt$ProvideAndroidAmbients$2.invoke(AndroidAmbients.kt:89)
	at androidx.ui.core.AndroidAmbientsKt$ProvideAndroidAmbients$2.invoke(Unknown Source:14)