Abhimanyu
01/12/2025, 7:36 AMGiven component holder class androidx.activity.ComponentActivity does not implement interface dagger.hilt.internal.GeneratedComponent or interface dagger.hilt.internal.GeneratedComponentManagerAbhimanyu
01/12/2025, 7:37 AMimport androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.navigation.compose.ComposeNavigator
import androidx.navigation.testing.TestNavHostController
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
internal class MyNavHostTest {
    @get:Rule
    val composeTestRule = createComposeRule()
    private lateinit var navHostController: TestNavHostController
    @Before
    fun setupAppNavHost() {
        composeTestRule.setContent {
            navHostController = TestNavHostController(
                context = LocalContext.current,
            )
            navHostController.navigatorProvider.addNavigator(
                navigator = ComposeNavigator(),
            )
            MyNavHost(
                navHostController = navHostController,
            )
        }
    }
    @Test
    fun startDestinationIsHome() {
        Assert.assertEquals(
            "home",
            navHostController.currentBackStackEntry?.destination?.route,
        )
    }
}calidion
01/12/2025, 7:38 AMAbhimanyu
01/12/2025, 7:38 AMcalidion
01/12/2025, 7:39 AMcalidion
01/12/2025, 7:40 AMcalidion
01/12/2025, 7:42 AMcalidion
01/12/2025, 7:43 AMChrimaeon
01/12/2025, 11:01 AMcreateComposeRuleAbhimanyu
01/12/2025, 11:08 AMChrimaeon
01/12/2025, 11:11 AM404Abhimanyu
01/12/2025, 11:12 AMAbhimanyu
01/12/2025, 11:13 AMChrimaeon
01/12/2025, 11:14 AMhiltandroidx.activity.ComponentActivityWinson Chiu
01/12/2025, 11:19 AMAbhimanyu
01/12/2025, 11:19 AMWinson Chiu
01/12/2025, 11:19 AMAbhimanyu
01/12/2025, 11:24 AMIt sounds like you're calling hiltViewModel somewhere in the composition tree.Yes, that would be the case as I am testing the
NavHost