Repository: android/nowinandroid
File: app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreenTest.kt (Kotlin)

Code before:
    @Inject
    lateinit var topicsRepository: TopicsRepository

    // The strings used for matching in these tests.
    private val placeholderText by composeTestRule.stringResource(FeatureTopicR.string.feature_topic_select_an_interest)
    private val listPaneTag = "interests:topics"

    private val Topic.testTag
        get() = "topic:${this.id}"

    // Overrides for device sizes.
    private enum class TestDeviceConfig(widthDp: Float, heightDp: Float) {
        Compact(412f, 915f),
        Expanded(1200f, 840f);

        val sizeOverride = DeviceConfigurationOverride.ForcedSize(DpSize(widthDp.dp, heightDp.dp))
        val adaptiveInfo = WindowAdaptiveInfo(
            windowSizeClass = WindowSizeClass.compute(widthDp, heightDp),
            windowPosture = Posture()
        )
    }

    @Before
    fun setup() {
        hiltRule.inject()
        composeTestRule.activityRule
    }

    @Test
    fun expandedWidth_initialState_showsTwoPanesWithPlaceholder() {
        composeTestRule.apply {
            setContent {
                with(TestDeviceConfig.Expanded) {
                    DeviceConfigurationOverride(override = sizeOverride) {
                        NiaTheme {
                            InterestsListDetailScreen(windowAdaptiveInfo = adaptiveInfo)
                        }
                    }
                }
            }

            onNodeWithTag(listPaneTag).assertIsDisplayed()
            onNodeWithText(placeholderText).assertIsDisplayed()
        }
    }

    @Test
    fun notExpandedWidth_initialState_showsListPane() {
        composeTestRule.apply {
            setContent {
                with(TestDeviceConfig.Compact) {

Review comment (suggestion):
I don't think this line is needed

```suggestion
```

Code after:
    @Inject
    lateinit var topicsRepository: TopicsRepository

    // The strings used for matching in these tests.
    private val placeholderText by composeTestRule.stringResource(FeatureTopicR.string.feature_topic_select_an_interest)
    private val listPaneTag = "interests:topics"

    private val Topic.testTag
        get() = "topic:${this.id}"

    // Overrides for device sizes.
    private enum class TestDeviceConfig(widthDp: Float, heightDp: Float) {
        Compact(412f, 915f),
        Expanded(1200f, 840f),
        ;

        val sizeOverride = DeviceConfigurationOverride.ForcedSize(DpSize(widthDp.dp, heightDp.dp))
        val adaptiveInfo = WindowAdaptiveInfo(
            windowSizeClass = WindowSizeClass.compute(widthDp, heightDp),
            windowPosture = Posture(),
        )
    }

    @Before
    fun setup() {
        hiltRule.inject()
    }

    /** Convenience function for getting all topics during tests, */
    private fun getTopics(): List<Topic> = runBlocking {
        topicsRepository.getTopics().first()
    }

    @Test
    fun expandedWidth_initialState_showsTwoPanesWithPlaceholder() {
        composeTestRule.apply {
            setContent {
                with(TestDeviceConfig.Expanded) {
                    DeviceConfigurationOverride(override = sizeOverride) {
                        NiaTheme {
                            InterestsListDetailScreen(windowAdaptiveInfo = adaptiveInfo)
                        }
                    }
                }
            }

            onNodeWithTag(listPaneTag).assertIsDisplayed()
            onNodeWithText(placeholderText).assertIsDisplayed()
        }
    }