Repository: corona-warn-app/cwa-app-android
File: Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/eventregistration/organizer/QrCodeDetailFragmentTest.kt (Kotlin)

Code before:
        )

        setupMockViewModel(
            object : QrCodeDetailViewModel.Factory {
                override fun create(traceLocationId: Long): QrCodeDetailViewModel {
                    return createViewModel(traceLocationId)
                }
            }
        )
    }

    @After
    fun teardown() {
        clearAllViewModels()
    }

    @Test
    fun eventDetailForSameDatesTest() {
        launchFragmentInContainer2<QrCodeDetailFragment>(
            fragmentArgs = QrCodeDetailFragmentArgs(
                traceLocationId = 1
            ).toBundle()
        )

        onView(withId(R.id.tl_organizer_title)).check(matches(withText("Jahrestreffen der deutschen SAP Anwendergruppe")))
        onView(withId(R.id.tl_organizer_subtitle)).check(matches(withText("Hauptstr. 3, 69115 Heidelberg")))
        onView(withId(R.id.eventDate)).check(matches(withText("21.06.2021, 18:00 - 21:00 Uhr")))
    }

    @Test
    fun eventDetailForDifferentDatesTest() {
        launchFragmentInContainer2<QrCodeDetailFragment>(
            fragmentArgs = QrCodeDetailFragmentArgs(
                traceLocationId = 2
            ).toBundle()
        )
        onView(withId(R.id.tl_organizer_title)).check(matches(withText("Event XYZ")))
        onView(withId(R.id.tl_organizer_subtitle)).check(matches(withText("Otto-Hahn-Str. 3, 123456 Berlin")))
        onView(withId(R.id.eventDate)).check(matches(withText("18.04.2021, 12:00 - 19.04.2021, 22:52 Uhr")))
    }

    private fun createViewModel(traceLocationId: Long) =
        QrCodeDetailViewModel(
            traceLocationId = traceLocationId,
            traceLocationRepository = traceLocationRepository,
            dispatcher = TestDispatcherProvider(),
            appConfigProvider = appConfigProvider
        )
}

@Module

Review comment (suggestion):
Maybe name these with the full name: `trace_location_organizer_title` to have consistencty. I see somewhere below that you have named others with their full name.

Code after:
        )

        setupMockViewModel(
            object : QrCodeDetailViewModel.Factory {
                override fun create(traceLocationId: Long): QrCodeDetailViewModel {
                    return createViewModel(traceLocationId)
                }
            }
        )
    }

    @After
    fun teardown() {
        clearAllViewModels()
    }

    @Test
    fun eventDetailForSameDatesTest() {
        launchFragmentInContainer2<QrCodeDetailFragment>(
            fragmentArgs = QrCodeDetailFragmentArgs(
                traceLocationId = 1
            ).toBundle()
        )

        onView(withId(R.id.trace_location_organizer_title)).check(matches(withText("Jahrestreffen der deutschen SAP Anwendergruppe")))
        onView(withId(R.id.trace_location_organizer_subtitle)).check(matches(withText("Hauptstr. 3, 69115 Heidelberg")))
        onView(withId(R.id.eventDate)).check(matches(withText("21.06.2021, 18:00 - 21:00 Uhr")))
    }

    @Test
    fun eventDetailForDifferentDatesTest() {
        launchFragmentInContainer2<QrCodeDetailFragment>(
            fragmentArgs = QrCodeDetailFragmentArgs(
                traceLocationId = 2
            ).toBundle()
        )
        onView(withId(R.id.trace_location_organizer_title)).check(matches(withText("Event XYZ")))
        onView(withId(R.id.trace_location_organizer_subtitle)).check(matches(withText("Otto-Hahn-Str. 3, 123456 Berlin")))
        onView(withId(R.id.eventDate)).check(matches(withText("18.04.2021, 12:00 - 19.04.2021, 22:52 Uhr")))
    }

    private fun createViewModel(traceLocationId: Long) =
        QrCodeDetailViewModel(
            traceLocationId = traceLocationId,
            traceLocationRepository = traceLocationRepository,
            dispatcher = TestDispatcherProvider(),
            appConfigProvider = appConfigProvider
        )
}

@Module