diff --git a/Corona-Warn-App/build.gradle b/Corona-Warn-App/build.gradle index 06191fd03f637ca09a0d6667492c8d6102cd781e..f1ce04d22a2034f9a12eb3c21c97b4d5c96cc608 100644 --- a/Corona-Warn-App/build.gradle +++ b/Corona-Warn-App/build.gradle @@ -358,7 +358,7 @@ dependencies { testImplementation('org.robolectric:robolectric:4.5.1') { exclude group: 'com.google.protobuf' } - testImplementation "io.mockk:mockk:1.10.4" + testImplementation "io.mockk:mockk:1.11.0" testImplementation "com.squareup.okhttp3:mockwebserver:4.9.0" testImplementation 'org.hamcrest:hamcrest-library:2.2' @@ -391,11 +391,10 @@ dependencies { androidTestImplementation 'androidx.test:rules:1.3.0' androidTestImplementation 'androidx.test.ext:truth:1.3.0' androidTestImplementation 'androidx.work:work-testing:2.5.0' - androidTestImplementation "io.mockk:mockk-android:1.10.4" + androidTestImplementation "io.mockk:mockk-android:1.11.0" debugImplementation 'androidx.fragment:fragment-testing:1.2.5' debugImplementation 'androidx.test:core-ktx:1.3.0' - androidTestImplementation 'tools.fastlane:screengrab:2.0.0' androidTestImplementation "androidx.navigation:navigation-testing:$nav_version" // Play Services diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogFragmentTest.kt index c18496b74f1e74c700ffa3e4c1fe6779379f34e4..90b342355c0ac5b94af093b7c99954324dbab941 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogFragmentTest.kt @@ -15,17 +15,14 @@ import io.mockk.impl.annotations.MockK import io.mockk.spyk import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class DebugLogFragmentTest : BaseUITest() { @@ -38,13 +35,6 @@ class DebugLogFragmentTest : BaseUITest() { private lateinit var inactiveViewModel: DebugLogViewModel private lateinit var activeViewModel: DebugLogViewModel - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogUploadFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogUploadFragmentTest.kt index a093866ea6b58fd1994370d862a496a340e05f71..bb92eab6c32f725c34c7989d9517af771343b17d 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogUploadFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/bugreporting/DebugLogUploadFragmentTest.kt @@ -11,30 +11,20 @@ import io.mockk.impl.annotations.MockK import io.mockk.spyk import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class DebugLogUploadFragmentTest : BaseUITest() { @MockK lateinit var snapShotUploader: SnapshotUploader - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: DebugLogUploadViewModel @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryDayFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryDayFragmentTest.kt index cc57ba6dbf4711c57544025f1a8d630feea1f9f1..6fda25cb9e93f540fc2d07ec47bd7f6bdec52928 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryDayFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryDayFragmentTest.kt @@ -28,31 +28,20 @@ import kotlinx.coroutines.test.TestCoroutineScope import org.joda.time.LocalDate import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.selectTabAtPosition import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule -import tools.fastlane.screengrab.locale.LocaleUtil import java.util.Locale @RunWith(AndroidJUnit4::class) class ContactDiaryDayFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @MockK lateinit var contactDiaryRepository: ContactDiaryRepository private lateinit var viewModel: ContactDiaryDayViewModel @@ -69,7 +58,7 @@ class ContactDiaryDayFragmentTest : BaseUITest() { every { viewModel.uiState } returns MutableLiveData( ContactDiaryDayViewModel.UIState( - dayText = { LocalDate.now().toFormattedDay(LocaleUtil.getTestLocale() ?: Locale.getDefault()) }, + dayText = { LocalDate.now().toFormattedDay(Locale.getDefault()) }, dayTextContentDescription = { "Description" } ) ) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditLocationsFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditLocationsFragmentTest.kt index 7bb0ecd5062a7735297202b4362524f06a15969c..33e5fa12b55f69ad490bb17ecf19359af68c262a 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditLocationsFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditLocationsFragmentTest.kt @@ -15,28 +15,18 @@ import io.mockk.spyk import kotlinx.coroutines.test.TestCoroutineScope import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class ContactDiaryEditLocationsFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @MockK lateinit var contactDiaryRepository: ContactDiaryRepository private lateinit var viewModel: ContactDiaryEditLocationsViewModel diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditPersonsFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditPersonsFragmentTest.kt index 1e80c719953343b49ea88643eff6b2f4a32448f3..cfa9ad2301f386c74d8e0adbbec9a85852d9d5c4 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditPersonsFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryEditPersonsFragmentTest.kt @@ -15,28 +15,18 @@ import io.mockk.spyk import kotlinx.coroutines.test.TestCoroutineScope import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class ContactDiaryEditPersonsFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @MockK lateinit var contactDiaryRepository: ContactDiaryRepository private lateinit var viewModel: ContactDiaryEditPersonsViewModel diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryInformationPrivacyFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryInformationPrivacyFragmentTest.kt index 450d89231d4e06fe68a48b23781332f9d8531fcf..f2820196fb937248457c5db816a1dae3e8a7312e 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryInformationPrivacyFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryInformationPrivacyFragmentTest.kt @@ -2,24 +2,16 @@ package de.rki.coronawarnapp.ui.contactdiary import androidx.test.ext.junit.runners.AndroidJUnit4 import de.rki.coronawarnapp.ui.information.InformationPrivacyFragment -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith +import testhelpers.BaseUITest import testhelpers.takeScreenshot import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) -class ContactDiaryInformationPrivacyFragmentTest { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() +class ContactDiaryInformationPrivacyFragmentTest : BaseUITest() { @Test fun launch_fragment() { diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOnboardingFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOnboardingFragmentTest.kt index d1e4a35c6d93a28e1298bf871b2211d83c663186..d43c192590b4e012d1f25af200faac188133a331 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOnboardingFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOnboardingFragmentTest.kt @@ -9,25 +9,16 @@ import de.rki.coronawarnapp.contactdiary.ui.onboarding.ContactDiaryOnboardingFra import io.mockk.MockKAnnotations import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class ContactDiaryOnboardingFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() private val fragmentArgs = ContactDiaryOnboardingFragmentArgs( showBottomNav = false diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOverviewFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOverviewFragmentTest.kt index 6308bfb834c5f1d1d7839e4b289904cee67eae57..888c57eea81eaadde69b44861a4365370237f7f2 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOverviewFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/contactdiary/ContactDiaryOverviewFragmentTest.kt @@ -8,32 +8,22 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import dagger.Module import dagger.android.ContributesAndroidInjector import de.rki.coronawarnapp.R -import de.rki.coronawarnapp.contactdiary.storage.repo.ContactDiaryRepository -import de.rki.coronawarnapp.contactdiary.ui.exporter.ContactDiaryExporter import de.rki.coronawarnapp.contactdiary.ui.overview.ContactDiaryOverviewFragment import de.rki.coronawarnapp.contactdiary.ui.overview.ContactDiaryOverviewViewModel import de.rki.coronawarnapp.contactdiary.ui.overview.adapter.DiaryOverviewItem import de.rki.coronawarnapp.contactdiary.ui.overview.adapter.day.DayOverviewItem import de.rki.coronawarnapp.contactdiary.ui.overview.adapter.day.contact.ContactItem import de.rki.coronawarnapp.contactdiary.ui.overview.adapter.subheader.OverviewSubHeaderItem -import de.rki.coronawarnapp.presencetracing.checkins.CheckInRepository -import de.rki.coronawarnapp.risk.storage.RiskLevelStorage -import de.rki.coronawarnapp.task.TaskController -import de.rki.coronawarnapp.util.TimeStamper import io.mockk.MockKAnnotations import io.mockk.every import io.mockk.impl.annotations.MockK -import io.mockk.spyk import org.joda.time.LocalDate import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule -import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchInMainActivity import testhelpers.recyclerScrollTo @@ -43,33 +33,11 @@ import testhelpers.takeScreenshot @RunWith(AndroidJUnit4::class) class ContactDiaryOverviewFragmentTest : BaseUITest() { - @MockK lateinit var taskController: TaskController - @MockK lateinit var contactDiaryRepository: ContactDiaryRepository - @MockK lateinit var riskLevelStorage: RiskLevelStorage - @MockK lateinit var timeStamper: TimeStamper - @MockK lateinit var exporter: ContactDiaryExporter - @MockK lateinit var checkInRepository: CheckInRepository - - private lateinit var viewModel: ContactDiaryOverviewViewModel - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() + @MockK lateinit var viewModel: ContactDiaryOverviewViewModel @Before fun setup() { MockKAnnotations.init(this, relaxed = true) - viewModel = spyk( - ContactDiaryOverviewViewModel( - taskController = taskController, - dispatcherProvider = TestDispatcherProvider(), - contactDiaryRepository = contactDiaryRepository, - riskLevelStorage = riskLevelStorage, - timeStamper = timeStamper, - checkInRepository = checkInRepository, - exporter = exporter - ) - ) - setupMockViewModel( object : ContactDiaryOverviewViewModel.Factory { override fun create(): ContactDiaryOverviewViewModel = viewModel diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt index ddff5cccc805194ed2d145c08d92578627efb569..3c4c0e9cfe92dc05dc01520feb305eaf0dda2d99 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt @@ -8,34 +8,18 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import dagger.Module import dagger.android.ContributesAndroidInjector import de.rki.coronawarnapp.R -import de.rki.coronawarnapp.appconfig.AppConfigProvider -import de.rki.coronawarnapp.coronatest.CoronaTestRepository -import de.rki.coronawarnapp.main.CWASettings -import de.rki.coronawarnapp.statistics.source.StatisticsProvider import de.rki.coronawarnapp.statistics.ui.homecards.StatisticsHomeCard -import de.rki.coronawarnapp.storage.TracingRepository -import de.rki.coronawarnapp.storage.TracingSettings -import de.rki.coronawarnapp.submission.SubmissionRepository import de.rki.coronawarnapp.submission.ui.homecards.PcrTestPositiveCard import de.rki.coronawarnapp.submission.ui.homecards.PcrTestSubmissionDoneCard import de.rki.coronawarnapp.submission.ui.homecards.RapidTestPositiveCard import de.rki.coronawarnapp.submission.ui.homecards.RapidTestSubmissionDoneCard import de.rki.coronawarnapp.submission.ui.homecards.TestResultItem -import de.rki.coronawarnapp.tracing.GeneralTracingStatus -import de.rki.coronawarnapp.tracing.states.TracingStateProvider import de.rki.coronawarnapp.tracing.ui.homecards.TracingStateItem import de.rki.coronawarnapp.tracing.ui.statusbar.TracingHeaderState import de.rki.coronawarnapp.ui.main.home.items.FAQCard import de.rki.coronawarnapp.ui.main.home.items.HomeItem -import de.rki.coronawarnapp.ui.presencetracing.organizer.TraceLocationOrganizerSettings import de.rki.coronawarnapp.ui.statistics.Statistics -import de.rki.coronawarnapp.util.TimeStamper -import de.rki.coronawarnapp.util.bluetooth.BluetoothSupport -import de.rki.coronawarnapp.util.encryptionmigration.EncryptionErrorResetTool -import de.rki.coronawarnapp.util.shortcuts.AppShortcutsHelper import de.rki.coronawarnapp.util.ui.SingleLiveEvent -import de.rki.coronawarnapp.vaccination.core.VaccinationSettings -import de.rki.coronawarnapp.vaccination.core.repository.VaccinationRepository import de.rki.coronawarnapp.vaccination.ui.homecard.CreateVaccinationHomeCard import de.rki.coronawarnapp.vaccination.ui.homecard.VaccinationStatusItem import io.mockk.MockKAnnotations @@ -43,17 +27,13 @@ import io.mockk.Runs import io.mockk.every import io.mockk.impl.annotations.MockK import io.mockk.just -import io.mockk.spyk import io.mockk.verify import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule -import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchInMainActivity import testhelpers.recyclerScrollTo @@ -63,32 +43,11 @@ import timber.log.Timber @RunWith(AndroidJUnit4::class) class HomeFragmentTest : BaseUITest() { - @MockK lateinit var errorResetTool: EncryptionErrorResetTool - @MockK lateinit var tracingStatus: GeneralTracingStatus - @MockK lateinit var tracingStateProviderFactory: TracingStateProvider.Factory - @MockK lateinit var coronaTestRepository: CoronaTestRepository - @MockK lateinit var tracingRepository: TracingRepository - @MockK lateinit var submissionRepository: SubmissionRepository - @MockK lateinit var cwaSettings: CWASettings - @MockK lateinit var appConfigProvider: AppConfigProvider - @MockK lateinit var statisticsProvider: StatisticsProvider - @MockK lateinit var appShortcutsHelper: AppShortcutsHelper - @MockK lateinit var tracingSettings: TracingSettings - @MockK lateinit var vaccinationSettings: VaccinationSettings - @MockK lateinit var traceLocationOrganizerSettings: TraceLocationOrganizerSettings - @MockK lateinit var timeStamper: TimeStamper - @MockK lateinit var bluetoothSupport: BluetoothSupport - @MockK lateinit var vaccinationRepository: VaccinationRepository - - private lateinit var homeFragmentViewModel: HomeFragmentViewModel - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() + @MockK lateinit var homeFragmentViewModel: HomeFragmentViewModel @Before fun setup() { MockKAnnotations.init(this, relaxed = true) - homeFragmentViewModel = homeFragmentViewModelSpy() with(homeFragmentViewModel) { every { refreshRequiredData() } just Runs every { tracingHeaderState } returns MutableLiveData(TracingHeaderState.TracingActive) @@ -104,9 +63,6 @@ class HomeFragmentTest : BaseUITest() { override fun create(): HomeFragmentViewModel = homeFragmentViewModel } ) - - every { bluetoothSupport.isScanningSupported } returns true - every { bluetoothSupport.isAdvertisingSupported } returns true } @Screenshot @@ -271,8 +227,6 @@ class HomeFragmentTest : BaseUITest() { fun captureHomeFragmentCompatibilityBleBroadcastNotSupported() { every { homeFragmentViewModel.homeItems } returns homeFragmentItemsLiveData(HomeData.Tracing.TRACING_FAILED_ITEM) - every { bluetoothSupport.isScanningSupported } returns true - every { bluetoothSupport.isAdvertisingSupported } returns false launchInMainActivity<HomeFragment>() onView(withId(R.id.recycler_view)).perform(recyclerScrollTo(2)) captureHomeFragment("compatibility_ble_broadcast_not_supported") @@ -283,8 +237,6 @@ class HomeFragmentTest : BaseUITest() { fun captureHomeFragmentCompatibilityBleScanNotSupported() { every { homeFragmentViewModel.homeItems } returns homeFragmentItemsLiveData(HomeData.Tracing.TRACING_FAILED_ITEM) - every { bluetoothSupport.isScanningSupported } returns false - every { bluetoothSupport.isAdvertisingSupported } returns true launchInMainActivity<HomeFragment>() onView(withId(R.id.recycler_view)).perform(recyclerScrollTo(2)) captureHomeFragment("compatibility_ble_scan_not_supported") @@ -351,28 +303,6 @@ class HomeFragmentTest : BaseUITest() { takeScreenshot<HomeFragment>(nameSuffix) } - private fun homeFragmentViewModelSpy() = spyk( - HomeFragmentViewModel( - dispatcherProvider = TestDispatcherProvider(), - errorResetTool = errorResetTool, - tracingRepository = tracingRepository, - tracingStateProviderFactory = tracingStateProviderFactory, - appConfigProvider = appConfigProvider, - tracingStatus = tracingStatus, - submissionRepository = submissionRepository, - coronaTestRepository = coronaTestRepository, - cwaSettings = cwaSettings, - statisticsProvider = statisticsProvider, - appShortcutsHelper = appShortcutsHelper, - tracingSettings = tracingSettings, - traceLocationOrganizerSettings = traceLocationOrganizerSettings, - timeStamper = timeStamper, - bluetoothSupport = bluetoothSupport, - vaccinationSettings = vaccinationSettings, - vaccinationRepository = vaccinationRepository - ) - ) - // LiveData item for fragments private fun homeFragmentItemsLiveData( tracingStateItem: TracingStateItem = HomeData.Tracing.LOW_RISK_ITEM_WITH_ENCOUNTERS, diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingAnalyticsFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingAnalyticsFragmentTest.kt index 634908d8bedf93147d08614b1d69c075480182aa..bf3d78db5d61742aa855e58ae0b2ce4aa66e2ffc 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingAnalyticsFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingAnalyticsFragmentTest.kt @@ -18,16 +18,13 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOf import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot import testhelpers.launchFragment2 -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingAnalyticsFragmentTest : BaseUITest() { @@ -38,13 +35,6 @@ class OnboardingAnalyticsFragmentTest : BaseUITest() { private lateinit var viewModel: OnboardingAnalyticsViewModel - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingDeltaInteroperabilityFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingDeltaInteroperabilityFragmentTest.kt index 0b32b217db31b50f5e6db3e94cdf46a91eca4a36..59aa5218a55c251877fc21b95402def9f11bcb27 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingDeltaInteroperabilityFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingDeltaInteroperabilityFragmentTest.kt @@ -8,30 +8,20 @@ import io.mockk.MockKAnnotations import io.mockk.impl.annotations.MockK import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingDeltaInteroperabilityFragmentTest : BaseUITest() { @MockK lateinit var interopRepo: InteroperabilityRepository - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragmentTest.kt index 37e5a4d49af8069975cbe544e3fd203ad12f2cca..f44312b0a24ca422377ed0b7930fbc6a275ce2ce 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragmentTest.kt @@ -7,27 +7,17 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import dagger.Module import dagger.android.ContributesAndroidInjector import de.rki.coronawarnapp.R -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Test fun launch_fragment() { launchFragment2<OnboardingFragment>() diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragmentTest.kt index 1954b667c2f2d1e31b7c694dbcada9a89437bba3..696b42d00f30847383ea152c0dac39fac75bf4cb 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragmentTest.kt @@ -5,27 +5,17 @@ import dagger.Module import dagger.android.ContributesAndroidInjector import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingNotificationsFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { setupMockViewModel( diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragmentTest.kt index 96af67c859188160d57d06f18998b0f7f70338cd..9f8e3c32274883e011adbac8e461f04e0f02c918 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingPrivacyFragmentTest.kt @@ -5,27 +5,17 @@ import dagger.Module import dagger.android.ContributesAndroidInjector import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingPrivacyFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { setupMockViewModel( diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragmentTest.kt index 3d07dec0fa7f0232c420edcc29de6bc38ea4f09e..60a2b5504849112a382066dd1324228b9fd6d60c 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragmentTest.kt @@ -5,27 +5,17 @@ import dagger.Module import dagger.android.ContributesAndroidInjector import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingTestFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { setupMockViewModel( diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragmentTest.kt index 61922e75255197b0c1ac393c21c0d9fc44b55765..6982b04721b40698adbcedb3aa592f1a0f6046de 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragmentTest.kt @@ -16,17 +16,14 @@ import io.mockk.spyk import kotlinx.coroutines.flow.flowOf import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class OnboardingTracingFragmentTest : BaseUITest() { @@ -36,13 +33,6 @@ class OnboardingTracingFragmentTest : BaseUITest() { @MockK lateinit var tracingSettings: TracingSettings @MockK lateinit var enfClient: ENFClient - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsCardsTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsCardsTest.kt deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsCardsTest.kt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsExplanationFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsExplanationFragmentTest.kt index 7553d59dacf7209eca60d40a46cce572fb9190c1..479ac33d76db4d140ab9b9ae75f9aa8475a28963 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsExplanationFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/statistics/StatisticsExplanationFragmentTest.kt @@ -4,25 +4,15 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import dagger.Module import dagger.android.ContributesAndroidInjector import de.rki.coronawarnapp.statistics.ui.StatisticsExplanationFragment -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.captureScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class StatisticsExplanationFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Screenshot @Test fun capture_screenshot() { diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionConsentFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionConsentFragmentTest.kt index 787e0d2edef770f5249fbc15a34cb6691cda6979..0bd7d1229ef471c0f770c2dbad0c7b0959cac19e 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionConsentFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionConsentFragmentTest.kt @@ -17,15 +17,12 @@ import io.mockk.impl.annotations.MockK import kotlinx.coroutines.flow.flowOf import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionConsentFragmentTest : BaseUITest() { @@ -36,13 +33,6 @@ class SubmissionConsentFragmentTest : BaseUITest() { @MockK lateinit var qrCodeRegistrationStateProcessor: QrCodeRegistrationStateProcessor @MockK lateinit var qrCodeValidator: CoronaTestQrCodeValidator - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: SubmissionConsentViewModel private val fragmentArgs = SubmissionConsentFragmentArgs( diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragmentTest.kt index ac04a0a70d5c7cfea2dc3b466b939b4aeefa3053..66084e47adef7b51f352c7096a953c68252a9990 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragmentTest.kt @@ -16,27 +16,17 @@ import de.rki.coronawarnapp.ui.submission.viewmodel.SubmissionContactViewModel import io.mockk.MockKAnnotations import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.captureScreenshot import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionContactFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private fun createViewModel() = SubmissionContactViewModel() @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragmentTest.kt index 3b63821e006fe20b28a940bd38b4946118dc5f84..8ae2f06dd909271f9a7fdd1d1d6f578c0572eee5 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragmentTest.kt @@ -20,30 +20,20 @@ import io.mockk.every import io.mockk.impl.annotations.MockK import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.preferences.mockFlowPreference import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionDispatcherFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @MockK lateinit var ratProfileSettings: RATProfileSettings private fun createViewModel() = SubmissionDispatcherViewModel( diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomCalendarFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomCalendarFragmentTest.kt index f80a5891dac19a7ad99103df39d43fd339c3b14a..5c252adb058b03bc5531cd8590e0fceb2b0393c9 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomCalendarFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomCalendarFragmentTest.kt @@ -22,16 +22,13 @@ import io.mockk.impl.annotations.MockK import io.mockk.spyk import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionSymptomCalendarFragmentTest : BaseUITest() { @@ -40,13 +37,6 @@ class SubmissionSymptomCalendarFragmentTest : BaseUITest() { @MockK lateinit var autoSubmission: AutoSubmission @MockK lateinit var analyticsKeySubmissionCollector: AnalyticsKeySubmissionCollector - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: SubmissionSymptomCalendarViewModel @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroFragmentTest.kt index eea3e2c4694675bfed5f4eea8c5473365dacf017..dce082f744367bdc5386b8f1b26f50b2e47353d6 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionSymptomIntroFragmentTest.kt @@ -23,18 +23,15 @@ import io.mockk.impl.annotations.MockK import io.mockk.spyk import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionSymptomIntroFragmentTest : BaseUITest() { @@ -43,13 +40,6 @@ class SubmissionSymptomIntroFragmentTest : BaseUITest() { @MockK lateinit var autoSubmission: AutoSubmission @MockK lateinit var analyticsKeySubmissionCollector: AnalyticsKeySubmissionCollector - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: SubmissionSymptomIntroductionViewModel @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragmentTest.kt index 4e5d114ea9d3fa3b8f8f9244065d2a716f3f04bd..d96287b09c5a54b49c28b8d01e9c5495f0e87f39 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragmentTest.kt @@ -16,17 +16,14 @@ import io.mockk.MockKAnnotations import io.mockk.impl.annotations.MockK import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionTanFragmentTest : BaseUITest() { @@ -38,13 +35,6 @@ class SubmissionTanFragmentTest : BaseUITest() { submissionRepository = submissionRepository ) - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultAvailableFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultAvailableFragmentTest.kt index b8c94ec58d480c7ac817a2f9c8e8e6c43e4eba56..d60699c944fea926b3671cf9a9f5abf12ebe8843 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultAvailableFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultAvailableFragmentTest.kt @@ -23,15 +23,12 @@ import io.mockk.spyk import kotlinx.coroutines.flow.flowOf import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionTestResultAvailableFragmentTest : BaseUITest() { @@ -47,13 +44,6 @@ class SubmissionTestResultAvailableFragmentTest : BaseUITest() { private val resultAvailableFragmentArgs = SubmissionTestResultConsentGivenFragmentArgs(testType = CoronaTest.Type.PCR).toBundle() - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultConsentGivenFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultConsentGivenFragmentTest.kt index 0a46163947b83aa2efa20f98966ddd6dbbd19496..0a10193fc31a979307108d14930c2a0faff61e39 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultConsentGivenFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultConsentGivenFragmentTest.kt @@ -30,17 +30,14 @@ import io.mockk.spyk import org.joda.time.Instant import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionTestResultConsentGivenFragmentTest : BaseUITest() { @@ -53,13 +50,6 @@ class SubmissionTestResultConsentGivenFragmentTest : BaseUITest() { private val consentGivenFragmentArgs = SubmissionTestResultConsentGivenFragmentArgs(testType = CoronaTest.Type.PCR).toBundle() - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: SubmissionTestResultConsentGivenViewModel private val navController = TestNavHostController( diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragmentTest.kt index e999cd17538d626427a53b0b0567547dda31faf7..0af3284c71a21bd7e28e441eb67d2810caf4e5f2 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragmentTest.kt @@ -24,17 +24,14 @@ import kotlinx.coroutines.flow.flowOf import org.joda.time.Instant import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionTestResultFragmentTest : BaseUITest() { @@ -44,13 +41,6 @@ class SubmissionTestResultFragmentTest : BaseUITest() { private val pendingFragmentArgs = SubmissionTestResultPendingFragmentArgs(testType = CoronaTest.Type.PCR).toBundle() - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNegativeFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNegativeFragmentTest.kt index 5439d17591b1392ad69982468357bf208cd4fc5d..34256e3a394f46e27311fa9d27e755f227888876 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNegativeFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNegativeFragmentTest.kt @@ -21,15 +21,12 @@ import kotlinx.coroutines.flow.flowOf import org.joda.time.Instant import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionTestResultNegativeFragmentTest : BaseUITest() { @@ -41,13 +38,6 @@ class SubmissionTestResultNegativeFragmentTest : BaseUITest() { private val resultNegativeFragmentArgs = SubmissionTestResultConsentGivenFragmentArgs(testType = CoronaTest.Type.PCR).toBundle() - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNoConsentGivenFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNoConsentGivenFragmentTest.kt index a1c88a8f2c3c0ff446a66b7ddf02a3010b69630f..94f0bc3c03fb518ceee69a14a97bf4098d325940 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNoConsentGivenFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultNoConsentGivenFragmentTest.kt @@ -21,15 +21,12 @@ import io.mockk.spyk import org.joda.time.Instant import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionTestResultNoConsentGivenFragmentTest : BaseUITest() { @@ -41,13 +38,6 @@ class SubmissionTestResultNoConsentGivenFragmentTest : BaseUITest() { private val noConsentGivenFragmentArgs = SubmissionTestResultConsentGivenFragmentArgs(testType = CoronaTest.Type.PCR).toBundle() - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: SubmissionTestResultNoConsentViewModel @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionYourConsentFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionYourConsentFragmentTest.kt index cd871668764b4b70aa3a3876611b154901b47b84..e801a642c497baf10780ff8e5ca190c1cbea18a1 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionYourConsentFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/submission/SubmissionYourConsentFragmentTest.kt @@ -15,15 +15,12 @@ import io.mockk.impl.annotations.MockK import kotlinx.coroutines.flow.flowOf import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.captureScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class SubmissionYourConsentFragmentTest : BaseUITest() { @@ -32,13 +29,6 @@ class SubmissionYourConsentFragmentTest : BaseUITest() { @MockK lateinit var interoperabilityRepository: InteroperabilityRepository @MockK lateinit var testType: CoronaTest.Type - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private lateinit var viewModel: SubmissionYourConsentViewModel @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/tracing/TracingDetailsFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/tracing/TracingDetailsFragmentTest.kt index 262b6e4252a1339a218b3d81877f9752564efdef..7caba09a4e9fbf9a8c8518a5247e521429c02b3f 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/tracing/TracingDetailsFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/tracing/TracingDetailsFragmentTest.kt @@ -21,17 +21,14 @@ import io.mockk.impl.annotations.MockK import io.mockk.spyk import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.TestDispatcherProvider import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class TracingDetailsFragmentTest : BaseUITest() { @@ -46,13 +43,6 @@ class TracingDetailsFragmentTest : BaseUITest() { private lateinit var viewModel: TracingDetailsFragmentViewModel - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - @Before fun setup() { MockKAnnotations.init(this, relaxed = true) diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt index 10e7acdf14539cb7128ede16db3fabccef1a6e4d..d3538b7baa72a237e1db4c78e08b85b38cb54e32 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt @@ -9,25 +9,16 @@ import io.mockk.MockKAnnotations import io.mockk.impl.annotations.MockK import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class VaccinationConsentFragmentTest : BaseUITest() { - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() @MockK lateinit var viewModel: VaccinationConsentViewModel diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/details/VaccinationDetailsFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/details/VaccinationDetailsFragmentTest.kt index a63d7dbb9f73319145dd28bc793eab657bde6aec..25da8d359faaca07df106fd801d3d1c396b62b47 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/details/VaccinationDetailsFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/details/VaccinationDetailsFragmentTest.kt @@ -23,29 +23,19 @@ import org.joda.time.LocalDate import org.joda.time.format.DateTimeFormat import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) class VaccinationDetailsFragmentTest : BaseUITest() { @MockK lateinit var vaccinationDetailsViewModel: VaccinationDetailsViewModel - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private val args = VaccinationDetailsFragmentArgs("vaccinationCertificateId").toBundle() @Before diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/list/VaccinationListFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/list/VaccinationListFragmentTest.kt index ea39fc1ea9d06098313a369d852149660f8f7963..a017ec7b73ddda132d9d8e5cd549a2c5c30e99bf 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/list/VaccinationListFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/vaccination/ui/list/VaccinationListFragmentTest.kt @@ -30,29 +30,19 @@ import org.joda.time.LocalDate import org.joda.time.format.DateTimeFormat import org.junit.After import org.junit.Before -import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import testhelpers.BaseUITest import testhelpers.Screenshot -import testhelpers.SystemUIDemoModeRule import testhelpers.launchFragment2 import testhelpers.launchFragmentInContainer2 import testhelpers.takeScreenshot -import tools.fastlane.screengrab.locale.LocaleTestRule @RunWith(AndroidJUnit4::class) internal class VaccinationListFragmentTest : BaseUITest() { @MockK lateinit var vaccinationListViewModel: VaccinationListViewModel - @Rule - @JvmField - val localeTestRule = LocaleTestRule() - - @get:Rule - val systemUIDemoModeRule = SystemUIDemoModeRule() - private val applicationContext = ApplicationProvider.getApplicationContext<Context>() private val testQrCode = BitmapFactory.decodeResource(applicationContext.resources, R.drawable.test_qr_code) private val formatter = DateTimeFormat.forPattern("dd.MM.yyyy") diff --git a/Corona-Warn-App/src/androidTest/java/testhelpers/BaseUITest.kt b/Corona-Warn-App/src/androidTest/java/testhelpers/BaseUITest.kt index 65f9ce8d370be7e5ce6dde6358399da29c197d23..5adbbfc147c1fa84fbe3f7cca3bbbdd6a6364861 100644 --- a/Corona-Warn-App/src/androidTest/java/testhelpers/BaseUITest.kt +++ b/Corona-Warn-App/src/androidTest/java/testhelpers/BaseUITest.kt @@ -15,6 +15,9 @@ abstract class BaseUITest : BaseTestInstrumentation() { Manifest.permission.WRITE_EXTERNAL_STORAGE ) + @get:Rule + val systemUIDemoModeRule = SystemUIDemoModeRule() + inline fun <reified T : CWAViewModel> setupMockViewModel(factory: CWAViewModelFactory<T>) { MockViewModelModule.CREATORS[T::class.java] = factory } diff --git a/Corona-Warn-App/src/androidTest/java/testhelpers/ScreenShotter.kt b/Corona-Warn-App/src/androidTest/java/testhelpers/ScreenShotter.kt index c5002121e6e91c55d63de8968a335686f51e531c..3898fdd6547c0ba16645c0ba6fd4627ea265919d 100644 --- a/Corona-Warn-App/src/androidTest/java/testhelpers/ScreenShotter.kt +++ b/Corona-Warn-App/src/androidTest/java/testhelpers/ScreenShotter.kt @@ -8,11 +8,8 @@ import androidx.annotation.StyleRes import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentFactory import androidx.test.espresso.ViewAction +import androidx.test.platform.app.InstrumentationRegistry import de.rki.coronawarnapp.R -import tools.fastlane.screengrab.Screengrab -import tools.fastlane.screengrab.ScreenshotCallback -import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy -import tools.fastlane.screengrab.file.Chmod import java.io.BufferedOutputStream import java.io.File import java.io.FileOutputStream @@ -26,11 +23,8 @@ inline fun <reified T> takeScreenshot(suffix: String = "", delay: Long = SCREENS Thread.sleep(delay) val simpleName = T::class.simpleName val name = if (suffix.isEmpty()) simpleName else simpleName.plus("_$suffix") - Screengrab.screenshot( - name, - UiAutomatorScreenshotStrategy(), - SDCardCallback - ) + val screenshot = InstrumentationRegistry.getInstrumentation().uiAutomation.takeScreenshot() + SDCard.screenshotCaptured(name ?: System.currentTimeMillis().toString(), screenshot) } /** @@ -52,13 +46,13 @@ inline fun <reified F : Fragment> captureScreenshot( /** * Saves screenshots on the device's sdcard */ -object SDCardCallback : ScreenshotCallback { +object SDCard { private const val ROOT_DIRECTORY = "/sdcard" private const val SCREENSHOTS_DIRECTORY = "screenshots" private const val SCREENSHOT_FORMAT = ".png" private const val IMAGE_QUALITY = 100 - override fun screenshotCaptured(screenshotName: String, screenshot: Bitmap) { + fun screenshotCaptured(screenshotName: String, screenshot: Bitmap) { try { val directory = File(ROOT_DIRECTORY, SCREENSHOTS_DIRECTORY) if (!directory.exists()) { @@ -71,10 +65,9 @@ object SDCardCallback : ScreenshotCallback { BufferedOutputStream(FileOutputStream(screenshotFile)).use { screenshot.compress(Bitmap.CompressFormat.PNG, IMAGE_QUALITY, it) - Chmod.chmodPlusR(screenshotFile) screenshot.recycle() } - Log.d("Screengrab", "Captured screenshot \"${screenshotFile.name}\"") + Log.d("SDCard", "Captured screenshot \"${screenshotFile.name}\"") } catch (e: Exception) { throw RuntimeException("Unable to capture screenshot.", e) } diff --git a/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/keydownload/ui/KeyFileDownloadAdapter.kt b/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/keydownload/ui/KeyFileDownloadAdapter.kt index 231496e76e6f9cdfade364a62a2d1d19544a980c..97bfffb44647477cc9d9150fcd07fc5f94c8fcac 100644 --- a/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/keydownload/ui/KeyFileDownloadAdapter.kt +++ b/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/keydownload/ui/KeyFileDownloadAdapter.kt @@ -40,9 +40,9 @@ class KeyFileDownloadAdapter( class CachedKeyViewHolder( val parent: ViewGroup ) : BaseAdapter.VH( - R.layout.fragment_test_keydownload_adapter_line, - parent - ), + R.layout.fragment_test_keydownload_adapter_line, + parent + ), BindableVH<CachedKeyListItem, FragmentTestKeydownloadAdapterLineBinding> { override val viewBinding = lazy { FragmentTestKeydownloadAdapterLineBinding.bind(itemView) } diff --git a/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/submission/ui/TEKHistoryAdapter.kt b/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/submission/ui/TEKHistoryAdapter.kt index 88f6c7d674b8abffd11cafeeb281083d468ee20c..332a2fbf5019aff8aabff80cfd4187da1c8a75d0 100644 --- a/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/submission/ui/TEKHistoryAdapter.kt +++ b/Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/submission/ui/TEKHistoryAdapter.kt @@ -31,9 +31,9 @@ class TEKHistoryAdapter : BaseAdapter<TEKHistoryAdapter.VH>(), AsyncDiffUtilAdap class VH( val parent: ViewGroup ) : BaseAdapter.VH( - R.layout.fragment_test_submission_tekhistory_line, - parent - ), + R.layout.fragment_test_submission_tekhistory_line, + parent + ), BindableVH<TEKHistoryItem, FragmentTestSubmissionTekhistoryLineBinding> { override val viewBinding = lazy { FragmentTestSubmissionTekhistoryLineBinding.bind(itemView) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/appconfig/mapping/ExposureWindowRiskCalculationConfigMapper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/appconfig/mapping/ExposureWindowRiskCalculationConfigMapper.kt index dc447aff6d40db685a0c460a9a763396ff227b14..21c81facde9a6818dffb9fe7a5a155bd811094b5 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/appconfig/mapping/ExposureWindowRiskCalculationConfigMapper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/appconfig/mapping/ExposureWindowRiskCalculationConfigMapper.kt @@ -42,9 +42,9 @@ class ExposureWindowRiskCalculationConfigMapper @Inject constructor() : transmissionRiskLevelEncoding = riskCalculationParameters.trlEncoding, transmissionRiskLevelFilters = riskCalculationParameters.trlFiltersList, normalizedTimePerExposureWindowToRiskLevelMapping = - riskCalculationParameters.normalizedTimePerEWToRiskLevelMappingList, + riskCalculationParameters.normalizedTimePerEWToRiskLevelMappingList, normalizedTimePerDayToRiskLevelMappingList = - riskCalculationParameters.normalizedTimePerDayToRiskLevelMappingList, + riskCalculationParameters.normalizedTimePerDayToRiskLevelMappingList, transmissionRiskValueMapping = riskCalculationParameters.transmissionRiskValueMappingList, diagnosisKeysDataMapping = rawConfig.diagnosisKeysDataMapping() ) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/http/CwaWebException.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/http/CwaWebException.kt index 2f69c10266f4ca45208b7ff4062bf674fd5887ee..eb5a3bc33e9f9a21f68d516cf4ce9be46b87e260 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/http/CwaWebException.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/http/CwaWebException.kt @@ -22,10 +22,10 @@ open class CwaServerError( message: String?, cause: Throwable? = null ) : CwaWebException( - statusCode = statusCode, - message = message, - cause = cause -), + statusCode = statusCode, + message = message, + cause = cause + ), HasHumanReadableError { init { if (statusCode !in 500..599) { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportedException.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportedException.kt index b7e86078c60d9f642d3ff101f3a06a3daea866ca..6792d0a3c0d6c5d31bd1fa285a4a4e0678549503 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportedException.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ReportedException.kt @@ -8,9 +8,9 @@ open class ReportedException( cause: Throwable? = null, override val resId: Int? = null ) : Exception( - message, - cause -), + message, + cause + ), ReportedExceptionInterface open class ReportedIOException( @@ -19,9 +19,9 @@ open class ReportedIOException( cause: Throwable? = null, override val resId: Int? = null ) : IOException( - message, - cause -), + message, + cause + ), ReportedExceptionInterface interface ReportedExceptionInterface { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/InsufficientStorageException.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/InsufficientStorageException.kt index 931ccdbda95f3eb804c28153780d7eb20619ce0a..295ba520ca46bc23c32fb2e2d4ad5d2bfad561e0 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/InsufficientStorageException.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/InsufficientStorageException.kt @@ -9,8 +9,8 @@ import java.io.IOException class InsufficientStorageException( val result: DeviceStorage.CheckResult ) : IOException( - "Not enough free space: ${result.requiredBytes}B are required and only ${result.freeBytes}B are available." -), + "Not enough free space: ${result.requiredBytes}B are required and only ${result.freeBytes}B are available." + ), HasHumanReadableError { override fun toHumanReadableError(context: Context): HumanReadableError { diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/appconfig/sources/fallback/DefaultAppConfigSourceTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/appconfig/sources/fallback/DefaultAppConfigSourceTest.kt index cf21c6b07f6b0cb657363536e346f57084b7ec32..bc306b379040a02df9eb4edbc4ca324f1bb2999d 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/appconfig/sources/fallback/DefaultAppConfigSourceTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/appconfig/sources/fallback/DefaultAppConfigSourceTest.kt @@ -82,7 +82,8 @@ class DefaultAppConfigSourceTest : BaseIOTest() { @Test fun `exceptions when getting the default config are rethrown`() = runBlockingTest { - every { assetManager.open("default_app_config_android.bin") } throws FileNotFoundException("default_app_config_android.bin does not exist") + every { assetManager.open("default_app_config_android.bin") } throws + FileNotFoundException("default_app_config_android.bin does not exist") val instance = createInstance() shouldThrowAny { diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/CoronaTestCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/CoronaTestCensorTest.kt index 4522f2a9d556033b62ef5081996a6a8a374241f1..7414771a0930543829a224096ea204af9adc612d 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/CoronaTestCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/CoronaTestCensorTest.kt @@ -18,6 +18,7 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import testhelpers.BaseTest +@Suppress("MaxLineLength") class CoronaTestCensorTest : BaseTest() { @MockK lateinit var coronaTestRepository: CoronaTestRepository diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/DiaryLocationCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/DiaryLocationCensorTest.kt index 17610b27dc9fe6240db05de96a077ddc2090a846..9ed1e19a329dbe7e0804b76c0ad571be5148a1aa 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/DiaryLocationCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/DiaryLocationCensorTest.kt @@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test import testhelpers.BaseTest import kotlin.concurrent.thread +@Suppress("MaxLineLength") class DiaryLocationCensorTest : BaseTest() { @MockK lateinit var diaryRepo: ContactDiaryRepository diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RACoronaTestCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RACoronaTestCensorTest.kt index 960614377aa3a8c62a52c577f01661fede4bac79..9cb76199dfcb0de4f62d1237b4742ca3b2791425 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RACoronaTestCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RACoronaTestCensorTest.kt @@ -17,6 +17,7 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import testhelpers.BaseTest +@Suppress("MaxLineLength") internal class RACoronaTestCensorTest : BaseTest() { @MockK lateinit var coronaTestRepository: CoronaTestRepository diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RatQrCodeCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RatQrCodeCensorTest.kt index 443db598fc02260c14c027a9972bb84cb20d6fbe..1e524a83abfe9aca336f8f2b667b226bd94eb835 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RatQrCodeCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/RatQrCodeCensorTest.kt @@ -9,6 +9,7 @@ import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +@Suppress("MaxLineLength") internal class RatQrCodeCensorTest { private val testHash = "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/TraceLocationCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/TraceLocationCensorTest.kt index f3d274d7c515f95fc3f8dd0fec3f0bd049326632..0f64442f874c4d0c1c02b42d3568c3eb0289cfd6 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/TraceLocationCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/TraceLocationCensorTest.kt @@ -19,6 +19,7 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import testhelpers.BaseTest +@Suppress("MaxLineLength") internal class TraceLocationCensorTest : BaseTest() { @MockK lateinit var traceLocationRepo: TraceLocationRepository diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/submission/RatProfileCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/submission/RatProfileCensorTest.kt index e516437fe1aca97b49847e17c4de2f109d0a2439..cab39ec362ed0e1e67e36cd5a77ab5cce5a6e142 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/submission/RatProfileCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/submission/RatProfileCensorTest.kt @@ -14,6 +14,7 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import testhelpers.BaseTest +@Suppress("MaxLineLength") internal class RatProfileCensorTest : BaseTest() { @MockK lateinit var ratProfileSettings: RATProfileSettings diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/vaccination/CertificateQrCodeCensorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/vaccination/CertificateQrCodeCensorTest.kt index 5d2f3d05c0b3aa4d70bf2a9873d02a390248f0d3..d76f485edcb574882a874c0d91ee5c66624af335 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/vaccination/CertificateQrCodeCensorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/censors/vaccination/CertificateQrCodeCensorTest.kt @@ -10,6 +10,7 @@ import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +@Suppress("MaxLineLength") internal class CertificateQrCodeCensorTest { private val testRawString = diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/debuglog/internal/DebugLogStorageCheckTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/debuglog/internal/DebugLogStorageCheckTest.kt index d8d72156fb5a1456a0424138ebee550ef62d85ee..8be40df0b8a690c0ce101a64f9334e8af9576998 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/debuglog/internal/DebugLogStorageCheckTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/bugreporting/debuglog/internal/DebugLogStorageCheckTest.kt @@ -14,7 +14,6 @@ import io.mockk.mockk import io.mockk.slot import io.mockk.verify import kotlinx.coroutines.test.runBlockingTest -import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import testhelpers.BaseTest @@ -37,10 +36,6 @@ class DebugLogStorageCheckTest : BaseTest() { coEvery { logWriter.write(any()) } just Runs } - @AfterEach - fun teardown() { - } - private fun createInstance() = DebugLogStorageCheck( targetPath = targetPath, timeProvider = { ourTime }, diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/ContactDiarySettingsTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/ContactDiarySettingsTest.kt index f2827a44b88b15776010dc7cb49964edb6520d6d..df46c8f1755c4872b25a67e88b9715d8190ceaad 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/ContactDiarySettingsTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/ContactDiarySettingsTest.kt @@ -42,8 +42,9 @@ class ContactDiarySettingsTest { } @Test - fun `onboarded`() { + fun onboarded() { every { intPreference.value } returns 1 - ContactDiarySettings(preferences).onboardingStatus shouldBe ContactDiarySettings.OnboardingStatus.RISK_STATUS_1_12 + ContactDiarySettings(preferences).onboardingStatus shouldBe + ContactDiarySettings.OnboardingStatus.RISK_STATUS_1_12 } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditLocationsViewModelTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditLocationsViewModelTest.kt index e3c6768ae4f33fdc3cec8df266f4b09a1e96c17d..abf4044dea91a5e223a54618c909f1d116a427f0 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditLocationsViewModelTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditLocationsViewModelTest.kt @@ -52,7 +52,8 @@ class ContactDiaryEditLocationsViewModelTest { viewModel = createInstance() viewModel.navigationEvent.observeForever { } viewModel.onDeleteAllLocationsClick() - viewModel.navigationEvent.value shouldBe ContactDiaryEditLocationsViewModel.NavigationEvent.ShowDeletionConfirmationDialog + viewModel.navigationEvent.value shouldBe + ContactDiaryEditLocationsViewModel.NavigationEvent.ShowDeletionConfirmationDialog } @Test @@ -75,7 +76,9 @@ class ContactDiaryEditLocationsViewModelTest { viewModel.navigationEvent.observeForever { } viewModel.onEditLocationClick(location) viewModel.navigationEvent.value shouldBe - ContactDiaryEditLocationsViewModel.NavigationEvent.ShowLocationDetailFragment(location.toContactDiaryLocationEntity()) + ContactDiaryEditLocationsViewModel.NavigationEvent.ShowLocationDetailFragment( + location.toContactDiaryLocationEntity() + ) } @Test diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditPersonsViewModelTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditPersonsViewModelTest.kt index babe9784bcf715e537e38f9b0cc1230aaf5d282f..8acd015c5e31fdcf34b4f6451ba3e56446b056f6 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditPersonsViewModelTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/edit/ContactDiaryEditPersonsViewModelTest.kt @@ -51,7 +51,8 @@ class ContactDiaryEditPersonsViewModelTest { viewModel = createInstance() viewModel.navigationEvent.observeForever { } viewModel.onDeleteAllPersonsClick() - viewModel.navigationEvent.value shouldBe ContactDiaryEditPersonsViewModel.NavigationEvent.ShowDeletionConfirmationDialog + viewModel.navigationEvent.value shouldBe + ContactDiaryEditPersonsViewModel.NavigationEvent.ShowDeletionConfirmationDialog } @Test @@ -74,7 +75,9 @@ class ContactDiaryEditPersonsViewModelTest { viewModel.navigationEvent.observeForever { } viewModel.onEditPersonClick(person) viewModel.navigationEvent.value shouldBe - ContactDiaryEditPersonsViewModel.NavigationEvent.ShowPersonDetailFragment(person.toContactDiaryPersonEntity()) + ContactDiaryEditPersonsViewModel.NavigationEvent.ShowPersonDetailFragment( + person.toContactDiaryPersonEntity() + ) } @Test diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/exporter/ContactDiaryExporterTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/exporter/ContactDiaryExporterTest.kt index 3e31ce1cb90e0653d861a483ea0ea3306db47a8c..14b11d57ca4d789177813c0596088ab5067fcb01 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/exporter/ContactDiaryExporterTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/exporter/ContactDiaryExporterTest.kt @@ -25,6 +25,7 @@ import testhelpers.extensions.CoroutinesTestExtension @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(MockKExtension::class, CoroutinesTestExtension::class) +@Suppress("MaxLineLength") internal class ContactDiaryExporterTest { @MockK lateinit var timeStamper: TimeStamper @@ -74,17 +75,17 @@ internal class ContactDiaryExporterTest { personEncounters = emptyList(), locationVisits = emptyList(), expectedExport = - """ + """ Kontakte der letzten 15 Tage (01.01.2021 - 15.01.2021) Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG. - """.trimIndent() + """.trimIndent() ), ExporterTestItem( personEncounters = ContactDiaryData.TWO_PERSONS_NO_ADDITIONAL_DATA, locationVisits = ContactDiaryData.TWO_LOCATIONS_NO_ADDITIONAL_DATA, expectedExport = - """ + """ Kontakte der letzten 15 Tage (01.01.2021 - 15.01.2021) Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG. @@ -93,13 +94,13 @@ internal class ContactDiaryExporterTest { 01.01.2021 Andrea Steinhauer 01.01.2021 Bakery - """.trimIndent() + """.trimIndent() ), ExporterTestItem( personEncounters = ContactDiaryData.TWO_PERSONS_WITH_PHONE_NUMBERS, locationVisits = ContactDiaryData.TWO_LOCATIONS_WITH_EMAIL, expectedExport = - """ + """ Kontakte der letzten 15 Tage (01.01.2021 - 15.01.2021) Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG. @@ -108,13 +109,13 @@ internal class ContactDiaryExporterTest { 01.01.2021 Andrea Steinhauer; Tel. +49 123 456789 01.01.2021 Bakery; eMail baker@ibakeyourbread.com - """.trimIndent() + """.trimIndent() ), ExporterTestItem( personEncounters = ContactDiaryData.TWO_PERSONS_WITH_PHONE_NUMBERS_AND_EMAIL, locationVisits = ContactDiaryData.TWO_LOCATIONS_WITH_PHONE_NUMBERS_AND_EMAIL, expectedExport = - """ + """ Kontakte der letzten 15 Tage (01.01.2021 - 15.01.2021) Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG. @@ -123,13 +124,13 @@ internal class ContactDiaryExporterTest { 01.01.2021 Andrea Steinhauer; Tel. +49 123 456789; eMail andrea.steinhauer@example.com 01.01.2021 Bakery; Tel. +11 222 333333; eMail baker@ibakeyourbread.com - """.trimIndent() + """.trimIndent() ), ExporterTestItem( personEncounters = ContactDiaryData.TWO_PERSONS_WITH_ATTRIBUTES, locationVisits = ContactDiaryData.TWO_LOCATIONS_WITH_DURATION, expectedExport = - """ + """ Kontakte der letzten 15 Tage (01.01.2021 - 15.01.2021) Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG. @@ -138,13 +139,13 @@ internal class ContactDiaryExporterTest { 01.01.2021 Andrea Steinhauer; Kontaktdauer < 15 Minuten; mit Maske; im Freien 01.01.2021 Bakery; Dauer 00:15 h - """.trimIndent() + """.trimIndent() ), ExporterTestItem( personEncounters = ContactDiaryData.TWO_PERSONS_WITH_CIRCUMSTANCES, locationVisits = ContactDiaryData.TWO_LOCATIONS_WITH_CIRCUMSTANCES, expectedExport = - """ + """ Kontakte der letzten 15 Tage (01.01.2021 - 15.01.2021) Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG. @@ -153,7 +154,7 @@ internal class ContactDiaryExporterTest { 01.01.2021 Andrea Steinhauer; Sicherheitsmaßnahmen eingehalten 01.01.2021 Bakery; Very crowdy, but delicious bread - """.trimIndent() + """.trimIndent() ) ).map { testItem -> Arguments.of(testItem) } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/overview/ContactDiaryOverviewViewModelTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/overview/ContactDiaryOverviewViewModelTest.kt index 1644a3c1922d063b1876e5ad337aa53ad5f44d25..b8525e0b8f84f6ebbaef34ee5a62761dd0a424d2 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/overview/ContactDiaryOverviewViewModelTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/ui/overview/ContactDiaryOverviewViewModelTest.kt @@ -214,11 +214,13 @@ open class ContactDiaryOverviewViewModelTest { with(createInstance()) { onItemPress(listItem) val navigationEvent = routeToScreen.getOrAwaitValue() - navigationEvent should beInstanceOf(ContactDiaryOverviewNavigationEvents.NavigateToContactDiaryDayFragment::class) + navigationEvent should + beInstanceOf(ContactDiaryOverviewNavigationEvents.NavigateToContactDiaryDayFragment::class) navigationEvent as ContactDiaryOverviewNavigationEvents.NavigateToContactDiaryDayFragment - navigationEvent.localDateString shouldBe ContactDiaryOverviewNavigationEvents.NavigateToContactDiaryDayFragment( - listItem.date - ).localDateString + navigationEvent.localDateString shouldBe + ContactDiaryOverviewNavigationEvents.NavigateToContactDiaryDayFragment( + listItem.date + ).localDateString } } @@ -508,8 +510,10 @@ open class ContactDiaryOverviewViewModelTest { // In this test, now = January, 15 every { timeStamper.nowUTC } returns Instant.parse("2021-01-15T00:00:00.000Z") - every { contactDiaryRepository.personEncounters } returns flowOf(ContactDiaryData.TWO_PERSONS_WITH_PHONE_NUMBERS_AND_EMAIL) - every { contactDiaryRepository.locationVisits } answers { flowOf(ContactDiaryData.TWO_LOCATIONS_WITH_DURATION) } + every { contactDiaryRepository.personEncounters } returns + flowOf(ContactDiaryData.TWO_PERSONS_WITH_PHONE_NUMBERS_AND_EMAIL) + every { contactDiaryRepository.locationVisits } answers + { flowOf(ContactDiaryData.TWO_LOCATIONS_WITH_DURATION) } val vm = createInstance() diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/util/ContactDiaryExportStringsMock.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/util/ContactDiaryExportStringsMock.kt index 2690e74e2879e2b15c06a6f994f56894504406e4..64b3ce40401adfbdbfabd0b180df0b288b414020 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/util/ContactDiaryExportStringsMock.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/contactdiary/util/ContactDiaryExportStringsMock.kt @@ -20,13 +20,17 @@ fun mockStringsForContactDiaryExporterTests(context: Context) { every { context.getString(R.string.contact_diary_export_intro_two) - } answers { "Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG." } + } answers { + "Die nachfolgende Liste dient dem zuständigen Gesundheitsamt zur Kontaktnachverfolgung gem. § 25 IfSG." + } every { context.getString(R.string.contact_diary_export_prefix_phone) } returns "Tel." every { context.getString(R.string.contact_diary_export_prefix_email) } returns "eMail" - every { context.getString(R.string.contact_diary_export_durations_less_than_15min) } returns "Kontaktdauer < 15 Minuten" - every { context.getString(R.string.contact_diary_export_durations_longer_than_15min) } returns "Kontaktdauer > 15 Minuten" + every { context.getString(R.string.contact_diary_export_durations_less_than_15min) } returns + "Kontaktdauer < 15 Minuten" + every { context.getString(R.string.contact_diary_export_durations_longer_than_15min) } returns + "Kontaktdauer > 15 Minuten" every { context.getString(R.string.contact_diary_export_wearing_mask) } returns "mit Maske" every { context.getString(R.string.contact_diary_export_wearing_no_mask) } returns "ohne Maske" diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/coronatest/qrcode/TestQrCodes.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/coronatest/qrcode/TestQrCodes.kt index b29edd24deddfb62ba7a51a0d66a7c59a7376477..2756a5bd09888be7efc598def4c83a9ba4cc0f27 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/coronatest/qrcode/TestQrCodes.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/coronatest/qrcode/TestQrCodes.kt @@ -1,24 +1,39 @@ package de.rki.coronawarnapp.coronatest.qrcode -internal val pcrQrCode1 = "HTTPS://LOCALHOST/?123456-12345678-1234-4DA7-B166-B86D85475064" -internal val pcrQrCode2 = "https://localhost/?123456-12345678-1234-4DA7-B166-B86D85475064" -internal val pcrQrCode3 = "https://LOCALHOST/?123456-12345678-1234-4DA7-B166-B86D85475064" +internal const val pcrQrCode1 = "HTTPS://LOCALHOST/?123456-12345678-1234-4DA7-B166-B86D85475064" +internal const val pcrQrCode2 = "https://localhost/?123456-12345678-1234-4DA7-B166-B86D85475064" +internal const val pcrQrCode3 = "https://LOCALHOST/?123456-12345678-1234-4DA7-B166-B86D85475064" -internal val raQrCode1 = +@Suppress("MaxLineLength") +internal const val raQrCode1 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTgzMTEsInNhbHQiOiJBODczOTVDRjYyMjc1QzRCQjczMjAxOERFRTRDQzhCRSIsInRlc3RpZCI6IjQwNDBkNTRlLWIzNmYtNGQ1Yi05MThiLTExODZjM2E0OTZhNSIsImhhc2giOiI4MzFhNzNmNGZhODZkMDdjMjViOTdjNzdiZjg5MzNhN2Q5MzAzODIxZDRjNzdiZDc5YzlkNzJlMmU0ZTI1MWYyIiwiZm4iOiJEeWxhbiIsImxuIjoiR2FyZGluZXIiLCJkb2IiOiIxOTY3LTEyLTIyIn0=" -internal val raQrCode2 = + +@Suppress("MaxLineLength") +internal const val raQrCode2 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTgzMzMsInNhbHQiOiI5Nzk5OUY4QTBFMjBBMDgxMDMyMDdGQzkxOEQzRTVFRiIsInRlc3RpZCI6IjE3ZjFlOGMxLTBiMWMtNDE1Ni1iMTZkLTlmMmQwNzEzMDJmNSIsImhhc2giOiIzMDcxNmQzM2FkNDFhZjQwNTk1Y2IyOThkMDcwMDllM2QwZjIxZDk5Njg4ZWZkOTIyNGQ4OWQ0OTQ3YjRkZDU3IiwiZm4iOiJIYXJyaWV0IiwibG4iOiJCbGFuYyIsImRvYiI6IjE5OTUtMDItMTUifQ==" -internal val raQrCode3 = + +@Suppress("MaxLineLength") +internal const val raQrCode3 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTgzNTIsInNhbHQiOiJDRjBDNTQ3RkY2RDMwOTlBMkIwNkMxQzRFNEYwOEFGOSIsInRlc3RpZCI6ImY0N2VmODA0LTZmMGMtNDhiMy1hODY5LWUyZjg4NmIxMjU0ZiIsImhhc2giOiI3ZGNlMDhkYjBkNGFiZDVhYzFkMjQ5OGI1NzFhZmIyMjFjYTk0N2M3NWM4NDdkMDU0NjZiNGNmZTlkOTVkYzY2IiwiZm4iOiJKYWNvYiIsImxuIjoiVHlsZXIiLCJkb2IiOiIxOTYzLTAzLTE3In0=" -internal val raQrCode4 = + +@Suppress("MaxLineLength") +internal const val raQrCode4 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTgzNjksInNhbHQiOiJEQTg3M0YwOUJCQzZCQzVFMEQ0QTdBMzc2MjZERkMwNSIsInRlc3RpZCI6IjlmYjYzNWE2LThhZTQtNDVjZS1iZTZkLTg5MjdmMjM1ZmIzNiIsImhhc2giOiJmNGYzMDU0NTMwODI1MjkxYjhmMDQ3MWZkZTRiY2EzNTljOGVjZDI0ZTBmNTkxNTA5NTQyY2ZmNGJhNDBkNmY1IiwiZm4iOiJFZGRpZSIsImxuIjoiQm91Y2hlciIsImRvYiI6IjE5NzktMDEtMjMifQ==" -internal val raQrCode5 = + +@Suppress("MaxLineLength") +internal const val raQrCode5 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTgzODIsInNhbHQiOiI2RUJCMUM4NTc0QUYxQzcwQkY2MTNGQjMzNDM3MkM3MiIsInRlc3RpZCI6Ijg2MzkzMTE1LWVkYjAtNGE3Zi1iZTg1LWEwYjViMjY5M2Q3MSIsImhhc2giOiIzMmQxYjk4MTRjNWU0ZjI3Mjc5NWU0NjNhMmViZjI5Y2Y1ZDZkYzdiZmRhODNhYzViZWY5Y2Q5M2E3YjMxMjYwIiwiZm4iOiJBZGVsYWlkZSIsImxuIjoiSHVpc21hbiIsImRvYiI6IjE5NTktMDgtMDIifQ==" -internal val raQrCode6 = + +@Suppress("MaxLineLength") +internal const val raQrCode6 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTgzOTcsInNhbHQiOiI3MDcyQzAyMTkyM0ZFOEMzMDVDNTAxQkU5MjQyMjNBQyIsInRlc3RpZCI6IjhmMzA0OTE4LWI2YmMtNDQyOS1iYzhlLWMzMzRkMjdhNTdiNCIsImhhc2giOiI2ZjVhMjJhYzY2ZTc1Y2JiYTE3MTBlN2IxZWMwZTllMDk4NjUyMjY0MWE3NTYyNGY0MGZhMDc4YTZkZjY0ZTVjIiwiZm4iOiJBbmRyZSIsImxuIjoiQmFyZ2VsbGluaSIsImRvYiI6IjE5OTItMTEtMDcifQ==" -internal val raQrCode7 = + +@Suppress("MaxLineLength") +internal const val raQrCode7 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MTg0MjMsInNhbHQiOiJEM0Y1MzcyODU2NkMxMDFENjE1MkVCQ0I0OEMxMkFCOCIsInRlc3RpZCI6Ijc5NWIxY2MwLWU2NjQtNGFmZi05NTk3LWU3MTk2ODE4ZGVmYiIsImhhc2giOiI3NmMxMjJiOTlmZWVmZmM5Mjc3MTE2YjUwZGIwZGM1NjI0ZjY5OWFiMzliMDAwOWMwYzg5YmRlMWNjZjM4YmQxIiwiZm4iOiJWaWN0b3JpYSIsImxuIjoiTWFubmVsbGkiLCJkb2IiOiIxOTc4LTA0LTIxIn0=" -internal val raQrCode8 = + +@Suppress("MaxLineLength") +internal const val raQrCode8 = "https://s.coronawarn.app?v=1#eyJ0aW1lc3RhbXAiOjE2MTk2MjEzMzEsInNhbHQiOiI5NERDMkUyRkNCNTE2NDFFQzA5RkZENjVEMkJEMDg4QiIsInRlc3RpZCI6ImMyMGI5OTgxLWZmNzAtNGRmOC1hYTAyLTUwOTdmMmJkN2YzYyIsImhhc2giOiI1MmVlZjA3YjQwYzU1ODM0OTg3MGQ3YTA2Yzc0OGIwOTAxNGMxMTBlYTkzYjZhNmRhNDhkOWI4NTU0NTU2MzY0In0=" // { @@ -30,7 +45,8 @@ internal val raQrCode8 = // "salt":"510f3d750c2fc631fbcfe32cb06bbba9", // "hash":"d6e4d0181d8109bf05b346a0d2e0ef0cc472eed70d9df8c4b9ae5c7a009f3e34" // } -internal val raQrCodeEmptyStrings = +@Suppress("MaxLineLength") +internal const val raQrCodeEmptyStrings = "https://s.coronawarn.app?v=1#ewogICAgImZuIjoiIiwKICAgICJsbiI6IiIsCiAgICAiZG9iIjoiIiwKICAgICJ0ZXN0aWQiOiIwZTYwMGI0Mi1jYzIxLTRlNzUtOTE0Yy03MDYwMzE0M2I2Y2IiLAogICAgInRpbWVzdGFtcCI6IDE2MTkwMTI5NTIsCiAgICAic2FsdCI6IjUxMGYzZDc1MGMyZmM2MzFmYmNmZTMyY2IwNmJiYmE5IiwKICAgICJoYXNoIjoiZDZlNGQwMTgxZDgxMDliZjA1YjM0NmEwZDJlMGVmMGNjNDcyZWVkNzBkOWRmOGM0YjlhZTVjN2EwMDlmM2UzNCIKfQ" // { @@ -42,5 +58,6 @@ internal val raQrCodeEmptyStrings = // "salt":"510f3d750c2fc631fbcfe32cb06bbba9", // "hash":"d6e4d0181d8109bf05b346a0d2e0ef0cc472eed70d9df8c4b9ae5c7a009f3e34" // } -internal val raQrIncompletePersonalData = +@Suppress("MaxLineLength") +internal const val raQrIncompletePersonalData = "https://s.coronawarn.app?v=1#ewogICAgImZuIjoiTWF4IiwKICAgICJsbiI6IiIsCiAgICAiZG9iIjoiIiwKICAgICJ0ZXN0aWQiOiIwZTYwMGI0Mi1jYzIxLTRlNzUtOTE0Yy03MDYwMzE0M2I2Y2IiLAogICAgInRpbWVzdGFtcCI6IDE2MTkwMTI5NTIsCiAgICAic2FsdCI6IjUxMGYzZDc1MGMyZmM2MzFmYmNmZTMyY2IwNmJiYmE5IiwKICAgICJoYXNoIjoiZDZlNGQwMTgxZDgxMDliZjA1YjM0NmEwZDJlMGVmMGNjNDcyZWVkNzBkOWRmOGM0YjlhZTVjN2EwMDlmM2UzNCIKfQ" diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/exposurewindows/AnalyticsExposureWindowDonorTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/exposurewindows/AnalyticsExposureWindowDonorTest.kt index 1014934eee8cf81209338bd073b688b115b896d5..ad5057215f150baf9e666b3a65539fd88ff5144e 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/exposurewindows/AnalyticsExposureWindowDonorTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/exposurewindows/AnalyticsExposureWindowDonorTest.kt @@ -103,7 +103,9 @@ class AnalyticsExposureWindowDonorTest : BaseTest() { coEvery { analyticsExposureWindowRepository.getAllNew() } returns wrappers coEvery { analyticsExposureWindowRepository.moveToReported(wrappers) } returns reported runBlockingTest { - (donor.beginDonation(request) as AnalyticsExposureWindowDonor.Contribution).data shouldBe wrappers.asPpaData() + ( + donor.beginDonation(request) as AnalyticsExposureWindowDonor.Contribution + ).data shouldBe wrappers.asPpaData() } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/testresult/AnalyticsPCRTestResultTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/testresult/AnalyticsPCRTestResultTest.kt index ed70c6224ebdb58e6ccbb8aaa7e8d67ca8451aa5..cb7200c3615cdebda7eeb6df8ff989d53fb14f63 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/testresult/AnalyticsPCRTestResultTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/analytics/modules/testresult/AnalyticsPCRTestResultTest.kt @@ -88,9 +88,11 @@ class AnalyticsPCRTestResultTest : BaseTest() { fun `No donation when test result is PENDING and hours isn't greater or equal to config hours`() { runBlockingTest { every { testResultSettings.testScannedAfterConsent } returns mockFlowPreference(true) - every { testResultSettings.testResultAtRegistration } returns mockFlowPreference(CoronaTestResult.PCR_OR_RAT_PENDING) + every { testResultSettings.testResultAtRegistration } returns + mockFlowPreference(CoronaTestResult.PCR_OR_RAT_PENDING) - testResultDonor.beginDonation(TestRequest) shouldBe AnalyticsTestResultDonor.TestResultMetadataNoContribution + testResultDonor.beginDonation(TestRequest) shouldBe + AnalyticsTestResultDonor.TestResultMetadataNoContribution } } @@ -98,7 +100,8 @@ class AnalyticsPCRTestResultTest : BaseTest() { fun `Donation is collected when test result is PENDING and hours is greater or equal to config hours`() { runBlockingTest { every { testResultSettings.testScannedAfterConsent } returns mockFlowPreference(true) - every { testResultSettings.testResultAtRegistration } returns mockFlowPreference(CoronaTestResult.PCR_OR_RAT_PENDING) + every { testResultSettings.testResultAtRegistration } returns + mockFlowPreference(CoronaTestResult.PCR_OR_RAT_PENDING) val timeDayBefore = baseTime.minus(Duration.standardDays(1)) every { testResultSettings.testRegisteredAt } returns mockFlowPreference(timeDayBefore) @@ -118,7 +121,8 @@ class AnalyticsPCRTestResultTest : BaseTest() { fun `Donation is collected when test result is POSITIVE`() { runBlockingTest { every { testResultSettings.testScannedAfterConsent } returns mockFlowPreference(true) - every { testResultSettings.testResultAtRegistration } returns mockFlowPreference(CoronaTestResult.PCR_POSITIVE) + every { testResultSettings.testResultAtRegistration } returns + mockFlowPreference(CoronaTestResult.PCR_POSITIVE) every { testResultSettings.finalTestResultReceivedAt } returns mockFlowPreference(baseTime) val donation = @@ -137,7 +141,8 @@ class AnalyticsPCRTestResultTest : BaseTest() { fun `Donation is collected when test result is NEGATIVE`() { runBlockingTest { every { testResultSettings.testScannedAfterConsent } returns mockFlowPreference(true) - every { testResultSettings.testResultAtRegistration } returns mockFlowPreference(CoronaTestResult.PCR_NEGATIVE) + every { testResultSettings.testResultAtRegistration } returns + mockFlowPreference(CoronaTestResult.PCR_NEGATIVE) every { testResultSettings.finalTestResultReceivedAt } returns mockFlowPreference(baseTime) val donation = diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveyUrlProviderTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveyUrlProviderTest.kt index c12cda95a5ffb7fb0bde62c30659c60d29a96095..c6074c8157979d514b76216b1e35145867f42da0 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveyUrlProviderTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveyUrlProviderTest.kt @@ -29,9 +29,11 @@ internal class SurveyUrlProviderTest { @Test fun `provideUrl() should provide correct Url`() = runBlockingTest { val otp = UUID.randomUUID() - coEvery { appConfigProvider.getAppConfig().survey.surveyOnHighRiskUrl } returns "http://www.example.com".toHttpUrl() + coEvery { appConfigProvider.getAppConfig().survey.surveyOnHighRiskUrl } returns + "http://www.example.com".toHttpUrl() - createInstance().provideUrl(Surveys.Type.HIGH_RISK_ENCOUNTER, otp) shouldBe "http://www.example.com/?queryParamNameOtp=$otp" + createInstance().provideUrl(Surveys.Type.HIGH_RISK_ENCOUNTER, otp) shouldBe + "http://www.example.com/?queryParamNameOtp=$otp" } @Test diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveysTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveysTest.kt index 5b6ea68dab4c85b702949a8b27f0e58cbe821af4..4669903877d39673c36cd032a65bd74208b78090 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveysTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/datadonation/survey/SurveysTest.kt @@ -67,7 +67,7 @@ internal class SurveysTest : BaseTest() { } @Test - fun `isConsentNeeded() should return Needed when an authorized otp was invalidated due to a risk change from high to low risk`() = + fun `isConsentNeeded() returns Needed when an auth-otp was invalidated due to a risk change from high to low`() = runBlockingTest { every { oneTimePasswordRepo.otpAuthorizationResult } returns OTPAuthorizationResult( UUID.randomUUID(), diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/diagnosiskeys/download/HourPackageSyncToolTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/diagnosiskeys/download/HourPackageSyncToolTest.kt index 1f5590a3854f00be5f4accf70481ebaf816ca4b4..4eededb2983d515488b03fbc418cd1d6d6e78861 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/diagnosiskeys/download/HourPackageSyncToolTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/diagnosiskeys/download/HourPackageSyncToolTest.kt @@ -51,10 +51,13 @@ class HourPackageSyncToolTest : CommonSyncToolTest() { mockCachedHour("EUR".loc, "2020-01-04".day, "01:00".hour) val instance = createInstance() - instance.syncMissingHourPackages(listOf("EUR".loc), false) shouldBe BaseKeyPackageSyncTool.SyncResult( - successful = true, - newPackages = keyRepoData.values.filter { it.info.type == Type.LOCATION_HOUR && it.info.hour != "01:00".hour } - ) + instance.syncMissingHourPackages(listOf("EUR".loc), false) shouldBe + BaseKeyPackageSyncTool.SyncResult( + successful = true, + newPackages = keyRepoData.values.filter { + it.info.type == Type.LOCATION_HOUR && it.info.hour != "01:00".hour + } + ) coVerifySequence { configProvider.getAppConfig() @@ -93,10 +96,13 @@ class HourPackageSyncToolTest : CommonSyncToolTest() { ) val instance = createInstance() - instance.syncMissingHourPackages(listOf("EUR".loc), false) shouldBe BaseKeyPackageSyncTool.SyncResult( - successful = true, - newPackages = keyRepoData.values.filter { it.info.type == Type.LOCATION_HOUR && it.info.hour != "01:00".hour } - ) + instance.syncMissingHourPackages(listOf("EUR".loc), false) shouldBe + BaseKeyPackageSyncTool.SyncResult( + successful = true, + newPackages = keyRepoData.values.filter { + it.info.type == Type.LOCATION_HOUR && it.info.hour != "01:00".hour + } + ) coVerifySequence { configProvider.getAppConfig() @@ -156,10 +162,13 @@ class HourPackageSyncToolTest : CommonSyncToolTest() { } val instance = createInstance() - instance.syncMissingHourPackages(listOf("EUR".loc), false) shouldBe BaseKeyPackageSyncTool.SyncResult( - successful = false, - newPackages = keyRepoData.values.filter { it.info.type == Type.LOCATION_HOUR && it.info.hour != "01:00".hour } - ) + instance.syncMissingHourPackages(listOf("EUR".loc), false) shouldBe + BaseKeyPackageSyncTool.SyncResult( + successful = false, + newPackages = keyRepoData.values.filter { + it.info.type == Type.LOCATION_HOUR && it.info.hour != "01:00".hour + } + ) coVerifySequence { configProvider.getAppConfig() diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/detectiontracker/ExposureDetectionTrackerExtensionsTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/detectiontracker/ExposureDetectionTrackerExtensionsTest.kt index beb1bd1ef988ec42f6dd8616892e964214741dd1..2290a980f113421fdc7b53eec67fdb2bc36e1f87 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/detectiontracker/ExposureDetectionTrackerExtensionsTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/detectiontracker/ExposureDetectionTrackerExtensionsTest.kt @@ -8,7 +8,6 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runBlockingTest import org.joda.time.Instant -import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import testhelpers.BaseTest @@ -26,10 +25,6 @@ class ExposureDetectionTrackerExtensionsTest : BaseTest() { every { tracker.calculations } returns fakeCalculations } - @AfterEach - fun teardown() { - } - private fun createFakeCalculation( startedAt: Instant, result: TrackedExposureDetection.Result? = TrackedExposureDetection.Result.NO_MATCHES diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/diagnosiskeyprovider/DefaultDiagnosisKeyProviderTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/diagnosiskeyprovider/DefaultDiagnosisKeyProviderTest.kt index 82f99876f412817e96cae6c7ce475717c16e5f06..0772e14d36115a8d83a9b878001c0f02504137da 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/diagnosiskeyprovider/DefaultDiagnosisKeyProviderTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/diagnosiskeyprovider/DefaultDiagnosisKeyProviderTest.kt @@ -42,7 +42,8 @@ class DefaultDiagnosisKeyProviderTest : BaseTest() { coEvery { googleENFClient.provideDiagnosisKeys(any<List<File>>()) } returns MockGMSTask.forValue(null) - coEvery { googleENFClient.provideDiagnosisKeys(any<DiagnosisKeyFileProvider>()) } returns MockGMSTask.forValue(null) + coEvery { googleENFClient.provideDiagnosisKeys(any<DiagnosisKeyFileProvider>()) } returns + MockGMSTask.forValue(null) coEvery { enfVersion.requireMinimumVersion(any()) } returns Unit } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tekhistory/DefaultTEKHistoryProviderTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tekhistory/DefaultTEKHistoryProviderTest.kt index 129e488001b32d78090f9dd151e81879b9a9aa07..097ec369fff2a425922340e99b368b124a9ecab3 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tekhistory/DefaultTEKHistoryProviderTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tekhistory/DefaultTEKHistoryProviderTest.kt @@ -315,7 +315,8 @@ class DefaultTEKHistoryProviderTest : BaseTest() { val mockTEK = mockk<TemporaryExposureKey>() every { client.temporaryExposureKeyHistory } returns MockGMSTask.forValue(listOf(mockTEK)) every { client.requestPreAuthorizedTemporaryExposureKeyHistory() } returns MockGMSTask.forValue(null) - every { client.requestPreAuthorizedTemporaryExposureKeyRelease() } returns MockGMSTask.forError(RuntimeException()) + every { client.requestPreAuthorizedTemporaryExposureKeyRelease() } returns + MockGMSTask.forError(RuntimeException()) val onTEKHistoryAvailable = mockk<(List<TemporaryExposureKey>) -> Unit>(relaxed = true) val onPermissionRequired = mockk<(Status) -> Unit>(relaxed = true) @@ -342,7 +343,8 @@ class DefaultTEKHistoryProviderTest : BaseTest() { coEvery { enfVersion.isAtLeast(ENFVersion.V1_8) } returns true every { client.temporaryExposureKeyHistory } returns MockGMSTask.forError(IllegalStateException()) every { client.requestPreAuthorizedTemporaryExposureKeyHistory() } returns MockGMSTask.forValue(null) - every { client.requestPreAuthorizedTemporaryExposureKeyRelease() } returns MockGMSTask.forError(RuntimeException()) + every { client.requestPreAuthorizedTemporaryExposureKeyRelease() } returns + MockGMSTask.forError(RuntimeException()) runBlockingTest { shouldThrow<IllegalStateException> { diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tracing/DefaultTracingStatusTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tracing/DefaultTracingStatusTest.kt index 4c4b84d92987e7922f6f1a2cab308433012d5895..f5c43b0395ac015b6f01dd710b479f588af32488 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tracing/DefaultTracingStatusTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/modules/tracing/DefaultTracingStatusTest.kt @@ -139,11 +139,7 @@ class DefaultTracingStatusTest : BaseTest() { val tracingStatus = mockk<TracingStatus>().apply { every { isTracingEnabled } returns enabledFlow every { setTracing(any(), any(), any(), any()) } answers { - val enabled = arg<Boolean>(0) val onSuccess = arg<(Boolean) -> Unit>(1) - val onError = arg<(Throwable) -> Unit>(2) - val onPermissionRequired = arg<(Status) -> Unit>(3) - onSuccess(false) } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/windows/ExposureWindowsCalculationTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/windows/ExposureWindowsCalculationTest.kt index 4668c0e165817e96991fe088264c9d1f6fcf14ef..60b23979aa956d8a71af63705930cf7cc728bb10 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/windows/ExposureWindowsCalculationTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/nearby/windows/ExposureWindowsCalculationTest.kt @@ -19,7 +19,13 @@ import de.rki.coronawarnapp.nearby.windows.entities.configuration.JsonTrlFilter import de.rki.coronawarnapp.risk.DefaultRiskLevels import de.rki.coronawarnapp.risk.result.EwAggregatedRiskResult import de.rki.coronawarnapp.risk.result.RiskResult -import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.TransmissionRiskValueMapping +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.MinutesAtAttenuationFilter +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.MinutesAtAttenuationWeight +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.Range +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.TrlFilter +import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass.TransmissionRiskLevelEncoding import de.rki.coronawarnapp.util.TimeStamper import de.rki.coronawarnapp.util.serialization.fromJson import io.kotest.matchers.ints.shouldBeGreaterThan @@ -128,10 +134,14 @@ class ExposureWindowsCalculationTest : BaseTest() { // 6 - Check with expected result from test case aggregatedRiskResult.totalRiskLevel.number shouldBe case.expTotalRiskLevel - aggregatedRiskResult.mostRecentDateWithHighRisk shouldBe getTestCaseDate(case.expAgeOfMostRecentDateWithHighRiskInDays) - aggregatedRiskResult.mostRecentDateWithLowRisk shouldBe getTestCaseDate(case.expAgeOfMostRecentDateWithLowRiskInDays) - aggregatedRiskResult.totalMinimumDistinctEncountersWithHighRisk shouldBe case.expTotalMinimumDistinctEncountersWithHighRisk - aggregatedRiskResult.totalMinimumDistinctEncountersWithLowRisk shouldBe case.expTotalMinimumDistinctEncountersWithLowRisk + aggregatedRiskResult.mostRecentDateWithHighRisk shouldBe + getTestCaseDate(case.expAgeOfMostRecentDateWithHighRiskInDays) + aggregatedRiskResult.mostRecentDateWithLowRisk shouldBe + getTestCaseDate(case.expAgeOfMostRecentDateWithLowRiskInDays) + aggregatedRiskResult.totalMinimumDistinctEncountersWithHighRisk shouldBe + case.expTotalMinimumDistinctEncountersWithHighRisk + aggregatedRiskResult.totalMinimumDistinctEncountersWithLowRisk shouldBe + case.expTotalMinimumDistinctEncountersWithLowRisk } } @@ -213,56 +223,65 @@ class ExposureWindowsCalculationTest : BaseTest() { result.append("\n\n").append("----------------- \uD83D\uDEE0 CONFIGURATION \uD83D\uDEE0 -----------") result.append("\n").append("◦ Minutes At Attenuation Filters (${config.minutesAtAttenuationFilters.size})") - for (filter: RiskCalculationParametersOuterClass.MinutesAtAttenuationFilter in config.minutesAtAttenuationFilters) { + for ( + filter: MinutesAtAttenuationFilter in config.minutesAtAttenuationFilters + ) { result.append("\n\t").append("⇥ Filter") result.append(logRange(filter.attenuationRange, "Attenuation Range")) result.append(logRange(filter.dropIfMinutesInRange, "Drop If Minutes In Range")) } result.append("\n").append("◦ Minutes At Attenuation Weights (${config.minutesAtAttenuationWeights.size})") - for (weight: RiskCalculationParametersOuterClass.MinutesAtAttenuationWeight in config.minutesAtAttenuationWeights) { + for (weight: MinutesAtAttenuationWeight in config.minutesAtAttenuationWeights) { result.append("\n\t").append("⇥ Weight") result.append(logRange(weight.attenuationRange, "Attenuation Range")) result.append("\n\t\t").append("↳ Weight: ${weight.weight}") } + val mappingList = config.normalizedTimePerDayToRiskLevelMappingList result.append("\n") - .append("◦ Normalized Time Per Day To Risk Level Mapping List (${config.normalizedTimePerDayToRiskLevelMappingList.size})") - for (mapping: RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping in config.normalizedTimePerDayToRiskLevelMappingList) { + .append("◦ Normalized Time Per Day To Risk Level Mapping List (${mappingList.size})") + for (mapping: NormalizedTimeToRiskLevelMapping in mappingList) { result.append("\n\t").append("⇥ Mapping") result.append(logRange(mapping.normalizedTimeRange, "Normalized Time Range")) result.append("\n\t\t").append("↳ Risk Level: ${mapping.riskLevel}") } + val levelMapping = config.normalizedTimePerExposureWindowToRiskLevelMapping result.append("\n") - .append("◦ Normalized Time Per Exposure Window To Risk Level Mapping (${config.normalizedTimePerExposureWindowToRiskLevelMapping.size})") - for (mapping: RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping in config.normalizedTimePerExposureWindowToRiskLevelMapping) { + .append("◦ Normalized Time Per Exposure Window To Risk Level Mapping (${levelMapping.size})") + for (mapping: NormalizedTimeToRiskLevelMapping in levelMapping) { result.append("\n\t").append("⇥ Mapping") result.append(logRange(mapping.normalizedTimeRange, "Normalized Time Range")) result.append("\n\t\t").append("↳ Risk Level: ${mapping.riskLevel}") } result.append("\n").append("◦ Transmission Risk Level Encoding:") + val encoding = config.transmissionRiskLevelEncoding result.append("\n\t") - .append("↳ Infectiousness Offset High: ${config.transmissionRiskLevelEncoding.infectiousnessOffsetHigh}") + .append("↳ Infectiousness Offset High: ${encoding.infectiousnessOffsetHigh}") result.append("\n\t") - .append("↳ Infectiousness Offset Standard: ${config.transmissionRiskLevelEncoding.infectiousnessOffsetStandard}") + .append("↳ Infectiousness Offset Standard: ${encoding.infectiousnessOffsetStandard}") result.append("\n\t") - .append("↳ Report Type Offset Confirmed Clinical Diagnosis: ${config.transmissionRiskLevelEncoding.reportTypeOffsetConfirmedClinicalDiagnosis}") + .append( + "↳ Report Type Offset Confirmed Clinical Diagnosis: " + + "${encoding.reportTypeOffsetConfirmedClinicalDiagnosis}" + ) result.append("\n\t") - .append("↳ Report Type Offset Confirmed Test: ${config.transmissionRiskLevelEncoding.reportTypeOffsetConfirmedTest}") + .append("↳ Report Type Offset Confirmed Test: ${encoding.reportTypeOffsetConfirmedTest}") result.append("\n\t") - .append("↳ Report Type Offset Recursive: ${config.transmissionRiskLevelEncoding.reportTypeOffsetRecursive}") + .append("↳ Report Type Offset Recursive: ${encoding.reportTypeOffsetRecursive}") result.append("\n\t") - .append("↳ Report Type Offset Self Report: ${config.transmissionRiskLevelEncoding.reportTypeOffsetSelfReport}") + .append("↳ Report Type Offset Self Report: ${encoding.reportTypeOffsetSelfReport}") result.append("\n").append("◦ Transmission Risk Level Filters (${config.transmissionRiskLevelFilters.size})") - for (filter: RiskCalculationParametersOuterClass.TrlFilter in config.transmissionRiskLevelFilters) { + for (filter: TrlFilter in config.transmissionRiskLevelFilters) { result.append("\n\t").append("⇥ Trl Filter") result.append(logRange(filter.dropIfTrlInRange, "Drop If Trl In Range")) } - result.append("\n").appendLine("◦ Transmission Risk Value Mapping (${config.transmissionRiskValueMapping.size})") + result.append("\n") + .appendLine("◦ Transmission Risk Value Mapping (${config.transmissionRiskValueMapping.size})") for (mapping in config.transmissionRiskValueMapping) { result.append("\t").appendLine("⇥ Mapping") result.append("\t\t").append("↳ transmissionRiskLevel: ").appendLine(mapping.transmissionRiskLevel) @@ -273,7 +292,7 @@ class ExposureWindowsCalculationTest : BaseTest() { debugLog(result.toString(), LogLevel.NONE) } - private fun logRange(range: RiskCalculationParametersOuterClass.Range, rangeName: String): String { + private fun logRange(range: Range, rangeName: String): String { val builder = StringBuilder() builder.append("\n\t\t").append("⇥ $rangeName") builder.append("\n\t\t\t").append("↳ Min: ${range.min}") @@ -314,9 +333,9 @@ class ExposureWindowsCalculationTest : BaseTest() { configType = ConfigData.Type.FROM_SERVER ) - val attenuationFilters = mutableListOf<RiskCalculationParametersOuterClass.MinutesAtAttenuationFilter>() + val attenuationFilters = mutableListOf<MinutesAtAttenuationFilter>() for (jsonFilter: JsonMinutesAtAttenuationFilter in json.minutesAtAttenuationFilters) { - val filter: RiskCalculationParametersOuterClass.MinutesAtAttenuationFilter = mockk() + val filter: MinutesAtAttenuationFilter = mockk() every { filter.attenuationRange.min } returns jsonFilter.attenuationRange.min every { filter.attenuationRange.max } returns jsonFilter.attenuationRange.max every { filter.attenuationRange.minExclusive } returns jsonFilter.attenuationRange.minExclusive @@ -329,9 +348,9 @@ class ExposureWindowsCalculationTest : BaseTest() { } every { testConfig.minutesAtAttenuationFilters } returns attenuationFilters - val attenuationWeights = mutableListOf<RiskCalculationParametersOuterClass.MinutesAtAttenuationWeight>() + val attenuationWeights = mutableListOf<MinutesAtAttenuationWeight>() for (jsonWeight: JsonMinutesAtAttenuationWeight in json.minutesAtAttenuationWeights) { - val weight: RiskCalculationParametersOuterClass.MinutesAtAttenuationWeight = mockk() + val weight: MinutesAtAttenuationWeight = mockk() every { weight.attenuationRange.min } returns jsonWeight.attenuationRange.min every { weight.attenuationRange.max } returns jsonWeight.attenuationRange.max every { weight.attenuationRange.minExclusive } returns jsonWeight.attenuationRange.minExclusive @@ -342,10 +361,10 @@ class ExposureWindowsCalculationTest : BaseTest() { every { testConfig.minutesAtAttenuationWeights } returns attenuationWeights val normalizedTimePerDayToRiskLevelMapping = - mutableListOf<RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping>() + mutableListOf<NormalizedTimeToRiskLevelMapping>() for (jsonMapping: JsonNormalizedTimeToRiskLevelMapping in json.normalizedTimePerDayToRiskLevelMapping) { - val mapping: RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping = mockk() - every { mapping.riskLevel } returns RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.forNumber( + val mapping: NormalizedTimeToRiskLevelMapping = mockk() + every { mapping.riskLevel } returns NormalizedTimeToRiskLevelMapping.RiskLevel.forNumber( jsonMapping.riskLevel ) every { mapping.normalizedTimeRange.min } returns jsonMapping.normalizedTimeRange.min @@ -357,10 +376,10 @@ class ExposureWindowsCalculationTest : BaseTest() { every { testConfig.normalizedTimePerDayToRiskLevelMappingList } returns normalizedTimePerDayToRiskLevelMapping val normalizedTimePerExposureWindowToRiskLevelMapping = - mutableListOf<RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping>() + mutableListOf<NormalizedTimeToRiskLevelMapping>() for (jsonMapping: JsonNormalizedTimeToRiskLevelMapping in json.normalizedTimePerEWToRiskLevelMapping) { - val mapping: RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping = mockk() - every { mapping.riskLevel } returns RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.forNumber( + val mapping: NormalizedTimeToRiskLevelMapping = mockk() + every { mapping.riskLevel } returns NormalizedTimeToRiskLevelMapping.RiskLevel.forNumber( jsonMapping.riskLevel ) every { mapping.normalizedTimeRange.min } returns jsonMapping.normalizedTimeRange.min @@ -369,20 +388,22 @@ class ExposureWindowsCalculationTest : BaseTest() { every { mapping.normalizedTimeRange.maxExclusive } returns jsonMapping.normalizedTimeRange.maxExclusive normalizedTimePerExposureWindowToRiskLevelMapping.add(mapping) } - every { testConfig.normalizedTimePerExposureWindowToRiskLevelMapping } returns normalizedTimePerExposureWindowToRiskLevelMapping + every { testConfig.normalizedTimePerExposureWindowToRiskLevelMapping } returns + normalizedTimePerExposureWindowToRiskLevelMapping - val trlEncoding: RiskCalculationParametersOuterClass.TransmissionRiskLevelEncoding = mockk() + val trlEncoding: TransmissionRiskLevelEncoding = mockk() every { trlEncoding.infectiousnessOffsetHigh } returns json.trlEncoding.infectiousnessOffsetHigh every { trlEncoding.infectiousnessOffsetStandard } returns json.trlEncoding.infectiousnessOffsetStandard - every { trlEncoding.reportTypeOffsetConfirmedClinicalDiagnosis } returns json.trlEncoding.reportTypeOffsetConfirmedClinicalDiagnosis + every { trlEncoding.reportTypeOffsetConfirmedClinicalDiagnosis } returns + json.trlEncoding.reportTypeOffsetConfirmedClinicalDiagnosis every { trlEncoding.reportTypeOffsetConfirmedTest } returns json.trlEncoding.reportTypeOffsetConfirmedTest every { trlEncoding.reportTypeOffsetRecursive } returns json.trlEncoding.reportTypeOffsetRecursive every { trlEncoding.reportTypeOffsetSelfReport } returns json.trlEncoding.reportTypeOffsetSelfReport every { testConfig.transmissionRiskLevelEncoding } returns trlEncoding - val trlFilters = mutableListOf<RiskCalculationParametersOuterClass.TrlFilter>() + val trlFilters = mutableListOf<TrlFilter>() for (jsonFilter: JsonTrlFilter in json.trlFilters) { - val filter: RiskCalculationParametersOuterClass.TrlFilter = mockk() + val filter: TrlFilter = mockk() every { filter.dropIfTrlInRange.min } returns jsonFilter.dropIfTrlInRange.min every { filter.dropIfTrlInRange.max } returns jsonFilter.dropIfTrlInRange.max every { filter.dropIfTrlInRange.minExclusive } returns jsonFilter.dropIfTrlInRange.minExclusive @@ -392,9 +413,9 @@ class ExposureWindowsCalculationTest : BaseTest() { every { testConfig.transmissionRiskLevelFilters } returns trlFilters val transmissionRiskValueMapping = - mutableListOf<RiskCalculationParametersOuterClass.TransmissionRiskValueMapping>() + mutableListOf<TransmissionRiskValueMapping>() for (jsonMapping: JsonTransmissionRiskValueMapping in json.transmissionRiskValueMapping) { - val mapping: RiskCalculationParametersOuterClass.TransmissionRiskValueMapping = mockk() + val mapping: TransmissionRiskValueMapping = mockk() mapping.run { every { transmissionRiskLevel } returns jsonMapping.transmissionRiskLevel every { transmissionRiskValue } returns jsonMapping.transmissionRiskValue @@ -408,7 +429,8 @@ class ExposureWindowsCalculationTest : BaseTest() { val exposureWindow: ExposureWindow = mockk() every { exposureWindow.calibrationConfidence } returns json.calibrationConfidence - every { exposureWindow.dateMillisSinceEpoch } returns timeStamper.nowUTC.millis - (DateTimeConstants.MILLIS_PER_DAY * json.ageInDays).toLong() + every { exposureWindow.dateMillisSinceEpoch } returns + timeStamper.nowUTC.millis - (DateTimeConstants.MILLIS_PER_DAY * json.ageInDays).toLong() every { exposureWindow.infectiousness } returns json.infectiousness every { exposureWindow.reportType } returns json.reportType every { exposureWindow.scanInstances } returns json.scanInstances.map { scanInstance -> diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/common/CheckInExtensionTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/common/CheckInExtensionTest.kt index 8851229725e68370b9e06852532580e5431a8df5..8df161171dbd08e7607dd6a7de9f34d8804e43a9 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/common/CheckInExtensionTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/common/CheckInExtensionTest.kt @@ -47,7 +47,8 @@ class CheckInExtensionTest : BaseTest() { private fun CheckIn.validateLocationName() { locationName shouldBe when (traceLocationStart != null && traceLocationEnd != null) { - true -> "$description, $address, ${traceLocationStart?.toPrettyDate()} - ${traceLocationEnd?.toPrettyDate()}" + true -> + "$description, $address, ${traceLocationStart?.toPrettyDate()} - ${traceLocationEnd?.toPrettyDate()}" else -> "$description, $address" } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base32UrlProvider.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base32UrlProvider.kt index eb565268772c17a1da9876838064fffa33d1c1f9..6dc9403151c524a95666c4ce53601f8165a4cbdf 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base32UrlProvider.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base32UrlProvider.kt @@ -12,6 +12,7 @@ import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.ArgumentsProvider import java.util.stream.Stream +@Suppress("MaxLineLength") class Base32UrlProvider : ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { return Stream.of( diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base64UrlProvider.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base64UrlProvider.kt index b45bd725f0d1a0153b20ec78b60d3d6450460028..3e49160e0a00db786bf152a90800e0d71c836dfd 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base64UrlProvider.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/checkins/qrcode/Base64UrlProvider.kt @@ -16,8 +16,8 @@ class Base64UrlProvider : ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { return Stream.of( Arguments.of( - "https://e.coronawarn.app?v=1#CAESLAgBEhFNeSBCaXJ0aGRheSBQYXJ0eRoLYXQgbXkgcGxhY2Uo04ekATD3h6QBGmoIARJgO" + - "MTa6eYSiaDv8lW13xdYEvGHOZ1EYTiFSxt51HEoPCD7CNnvCUiIYPhax1MpkN0UfNClCm9ZWYy0JH01CDVD9eq-vox" + + "https://e.coronawarn.app?v=1#CAESLAgBEhFNeSBCaXJ0aGRheSBQYXJ0eRoLYXQgbXkgcGxhY2Uo04ekATD3h6QBGmoIAR" + + "JgOMTa6eYSiaDv8lW13xdYEvGHOZ1EYTiFSxt51HEoPCD7CNnvCUiIYPhax1MpkN0UfNClCm9ZWYy0JH01CDVD9eq-vox" + "Q1EcFJQkEIujVwoCNK0MNGuDK1ayjGxeDc4UDGgQxMjM0IgQIARAC", QRCodePayload.newBuilder() .setVersion(1) @@ -44,8 +44,8 @@ class Base64UrlProvider : ArgumentsProvider { .build() ), Arguments.of( - "https://e.coronawarn.app?v=1#CAESIAgBEg1JY2VjcmVhbSBTaG9wGg1NYWluIFN0cmVldCAxGmoIARJgOMTa6eYSiaDv8lW1" + - "3xdYEvGHOZ1EYTiFSxt51HEoPCD7CNnvCUiIYPhax1MpkN0UfNClCm9ZWYy0JH01CDVD9eq-voxQ" + + "https://e.coronawarn.app?v=1#CAESIAgBEg1JY2VjcmVhbSBTaG9wGg1NYWluIFN0cmVldCAxGmoIARJgOMTa6eYSiaDv8l" + + "W13xdYEvGHOZ1EYTiFSxt51HEoPCD7CNnvCUiIYPhax1MpkN0UfNClCm9ZWYy0JH01CDVD9eq-voxQ" + "1EcFJQkEIujVwoCNK0MNGuDK1ayjGxeDc4UDGgQxMjM0IgYIARABGAo", QRCodePayload.newBuilder() .setVersion(1) diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/locations/server/QrCodePosterTemplateServerTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/locations/server/QrCodePosterTemplateServerTest.kt index a23b791c1cd03be21cd465e15d508870e5b155e1..998e1a7143fbe41f8973a0fa5835e56b73d57918 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/locations/server/QrCodePosterTemplateServerTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/locations/server/QrCodePosterTemplateServerTest.kt @@ -124,21 +124,22 @@ internal class QrCodePosterTemplateServerTest : BaseTest() { .build()*/ private val POSTER_BUNDLE = ( - "504b03040a0000000800685588525c24ae70900100000e0300000a0000006578706f72742e62696e6d52cd4ac3401006410a0bde2c" + - "28280c9442556a9226db7aa8155a5b04154b1af0507bd89a6d8da45949b6507d099fc293275fa13e840fe0c527f0ec6e7e6ada" + - "744f33df7edf7c33b38bbe378bddf34e593bd65071fe36fff87c47480315d8f01101d4eba058cf4f149416e1c465638189a374" + - "c9980650113c53208d06a29e2d15a8b2461a9263e1a56307d0d7a57010432d36f5386871764d6d8734d90cfaaa20e9aa0a9a61" + - "0c964df4b449da25aa21639f8a9a497f2166d2804dfdfba493a8c10ef378922f302d8d246864b2ca8f8fd29b0e794890b48c5e" + - "329a24a0522d28ce840665934d88b74a1433aecd16915896c7c5680118d9dd1b4bbbbfa2de983f00c69212709f9289b8695a61" + - "2531246827608dc24c6edab2c3b074415d97c12df35dfb002c59ac6d4987b842e235f3e908a98091ba3850c558c7308205261c" + - "a21bef1fabd5329856cbf20c9ce2719f382ef593f7361913ff25fdb63de7858a5e201a95f83c6c0f57312a16db371d94475f85" + - "c6feddebfc147e7287bb5b1b47b946feb7b477b663c37609557285c8f50f504b03040a00000008006855885218d81ad88f0000" + - "008a0000000a0000006578706f72742e736967018a0075ff0a87010a380a1864652e726b692e636f726f6e617761726e617070" + - "2d6465761a02763122033236322a13312e322e3834302e31303034352e342e332e3210011801224730450220148d01176d9be9" + - "8fa78ca1b0cad0b8b12033f35a43cb7d10369536c233701fff022100ed7c748e7f8e82c6a98ead3a19f2041b1ec090268e3ae1" + - "5aa146bd0d567617c7504b01020a000a0000000800685588525c24ae70900100000e0300000a0000000000000000000000a401" + - "000000006578706f72742e62696e504b01020a000a00000008006855885218d81ad88f0000008a0000000a0000000000000000" + - "000000a401b80100006578706f72742e736967504b05060000000002000200700000006f0200000000" + "504b03040a0000000800685588525c24ae70900100000e0300000a0000006578706f72742e62696e6d52cd4ac3401006410" + + "a0bde2c28280c9442556a9226db7aa8155a5b04154b1af0507bd89a6d8da45949b6507d099fc293275fa13e840fe0c5" + + "27f0ec6e7e6ada744f33df7edf7c33b38bbe378bddf34e593bd65071fe36fff87c47480315d8f01101d4eba058cf4f1" + + "49416e1c465638189a374c9980650113c53208d06a29e2d15a8b2461a9263e1a56307d0d7a57010432d36f538687176" + + "4d6d8734d90cfaaa20e9aa0a9a610c964df4b449da25aa21639f8a9a497f2166d2804dfdfba493a8c10ef378922f302" + + "d8d246864b2ca8f8fd29b0e794890b48c5e329a24a0522d28ce840665934d88b74a1433aecd16915896c7c5680118d9" + + "dd1b4bbbbfa2de983f00c69212709f9289b8695a612531246827608dc24c6edab2c3b074415d97c12df35dfb002c59a" + + "c6d4987b842e235f3e908a98091ba3850c558c7308205261ca21bef1fabd5329856cbf20c9ce2719f382ef593f73619" + + "13ff25fdb63de7858a5e201a95f83c6c0f57312a16db371d94475f85c6feddebfc147e7287bb5b1b47b946feb7b477b" + + "663c37609557285c8f50f504b03040a00000008006855885218d81ad88f0000008a0000000a0000006578706f72742e" + + "736967018a0075ff0a87010a380a1864652e726b692e636f726f6e617761726e6170702d6465761a027631220332363" + + "22a13312e322e3834302e31303034352e342e332e3210011801224730450220148d01176d9be98fa78ca1b0cad0b8b1" + + "2033f35a43cb7d10369536c233701fff022100ed7c748e7f8e82c6a98ead3a19f2041b1ec090268e3ae15aa146bd0d5" + + "67617c7504b01020a000a0000000800685588525c24ae70900100000e0300000a0000000000000000000000a4010000" + + "00006578706f72742e62696e504b01020a000a00000008006855885218d81ad88f0000008a0000000a0000000000000" + + "000000000a401b80100006578706f72742e736967504b05060000000002000200700000006f0200000000" ).decodeHex() } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/calculation/CheckInWarningMatcherTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/calculation/CheckInWarningMatcherTest.kt index 52e215794f50a5b27cedbb9853e447bce06d214a..45545787ab0b92144abc621c9bc6b3f0bfaec096 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/calculation/CheckInWarningMatcherTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/calculation/CheckInWarningMatcherTest.kt @@ -182,6 +182,7 @@ class CheckInWarningMatcherTest : BaseTest() { endDateStr = "2021-03-04T10:12+01:00" ) + @Suppress("TooGenericExceptionThrown") val warningPackage = object : TraceWarningPackage { override suspend fun extractWarnings(): List<TraceWarning.TraceTimeIntervalWarning> { throw Exception() @@ -219,6 +220,7 @@ class CheckInWarningMatcherTest : BaseTest() { endDateStr = "2021-03-04T10:12+01:00" ) + @Suppress("TooGenericExceptionThrown") val warningPackage1 = object : TraceWarningPackage { override suspend fun extractWarnings() = throw Exception() diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/storage/PresenceTracingRiskRepositoryTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/storage/PresenceTracingRiskRepositoryTest.kt index ab4464a2e41681105bb35eda245bdb5a662ba7dd..b29dde3c5aa0ff9b5b8d4f5586cec95ba185d614 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/storage/PresenceTracingRiskRepositoryTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/presencetracing/risk/storage/PresenceTracingRiskRepositoryTest.kt @@ -103,9 +103,10 @@ class PresenceTracingRiskRepositoryTest : BaseTest() { localDateUtc = now.minus(100000).toLocalDateUtc(), riskState = RiskState.LOW_RISK ) - coEvery { presenceTracingRiskCalculator.calculateNormalizedTime(listOf(entity2.toCheckInWarningOverlap())) } returns listOf( - time - ) + coEvery { + presenceTracingRiskCalculator.calculateNormalizedTime(listOf(entity2.toCheckInWarningOverlap())) + } returns listOf(time) + coEvery { presenceTracingRiskCalculator.calculateCheckInRiskPerDay(listOf(time)) } returns listOf(riskPerDay) runBlockingTest { val riskStates = createInstance().traceLocationCheckInRiskStates.first() diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/BaseRiskLevelStorageTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/BaseRiskLevelStorageTest.kt index 38b4421e286b8a484c28ff27848a3fb1916b16d8..c3f5cbf6eb97897466a805f6e9ea1019e0f0b060 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/BaseRiskLevelStorageTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/BaseRiskLevelStorageTest.kt @@ -378,7 +378,8 @@ class BaseRiskLevelStorageTest : BaseTest() { ) ) ) - every { presenceTracingRiskRepository.presenceTracingDayRisk } returns flowOf(listOf(testPresenceTracingDayRisk)) + every { presenceTracingRiskRepository.presenceTracingDayRisk } returns + flowOf(listOf(testPresenceTracingDayRisk)) every { riskResultTables.latestAndLastSuccessful() } returns flowOf(listOf(testRiskLevelResultDao)) every { exposureWindowTables.getWindowsForResult(any()) } returns flowOf(listOf(testExposureWindowDaoWrapper)) @@ -437,7 +438,8 @@ class BaseRiskLevelStorageTest : BaseTest() { numberOfDaysWithHighRisk = 6 ) ) - every { presenceTracingRiskRepository.presenceTracingDayRisk } returns flowOf(listOf(testPresenceTracingDayRisk)) + every { presenceTracingRiskRepository.presenceTracingDayRisk } returns + flowOf(listOf(testPresenceTracingDayRisk)) every { riskResultTables.latestAndLastSuccessful() } returns flowOf(listOf(ewResultDao1, ewResultDao2)) every { exposureWindowTables.getWindowsForResult(any()) } returns flowOf(listOf(testExposureWindowDaoWrapper)) @@ -496,7 +498,8 @@ class BaseRiskLevelStorageTest : BaseTest() { numberOfDaysWithHighRisk = 6 ) ) - every { presenceTracingRiskRepository.presenceTracingDayRisk } returns flowOf(listOf(testPresenceTracingDayRisk)) + every { presenceTracingRiskRepository.presenceTracingDayRisk } returns + flowOf(listOf(testPresenceTracingDayRisk)) every { riskResultTables.latestAndLastSuccessful() } returns flowOf(listOf(ewResultDao1, ewResultDao2)) every { exposureWindowTables.getWindowsForResult(any()) } returns flowOf(listOf(testExposureWindowDaoWrapper)) diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/internal/PersistedRiskResultDaoTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/internal/PersistedRiskResultDaoTest.kt index 52e7ac6608e75a1db404491453f5d65442d29d09..2d080c2e438c50a6d62953b0ff6d563c853d5587 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/internal/PersistedRiskResultDaoTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/risk/storage/internal/PersistedRiskResultDaoTest.kt @@ -36,7 +36,8 @@ class PersistedRiskResultDaoTest : BaseTest() { failureReason shouldBe null ewAggregatedRiskResult shouldNotBe null ewAggregatedRiskResult?.apply { - totalRiskLevel shouldBe RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW + totalRiskLevel shouldBe + RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW totalMinimumDistinctEncountersWithLowRisk shouldBe 89 totalMinimumDistinctEncountersWithHighRisk shouldBe 59 mostRecentDateWithLowRisk shouldNotBe null @@ -71,7 +72,8 @@ class PersistedRiskResultDaoTest : BaseTest() { failureReason shouldBe null ewAggregatedRiskResult shouldNotBe null ewAggregatedRiskResult?.apply { - totalRiskLevel shouldBe RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW + totalRiskLevel shouldBe + RiskCalculationParametersOuterClass.NormalizedTimeToRiskLevelMapping.RiskLevel.LOW totalMinimumDistinctEncountersWithLowRisk shouldBe 89 totalMinimumDistinctEncountersWithHighRisk shouldBe 59 mostRecentDateWithLowRisk shouldNotBe null diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/statistics/source/StatisticsServerTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/statistics/source/StatisticsServerTest.kt index f1b7acf6554a37a2515723a0e55621f19952c1e5..56cbd7bf1e4f71335556b9de174645370c92f269 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/statistics/source/StatisticsServerTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/statistics/source/StatisticsServerTest.kt @@ -82,26 +82,24 @@ class StatisticsServerTest : BaseIOTest() { } companion object { - private val STATS_ZIP = - ( - "504b03041400080808008d4a2f520000000000000000000000000a0000006578706f72742e736967018b0074ff0a88010a380a" + - "1864652e726b692e636f726f6e617761726e6170702d6465761a02763122033236322a13312e322e3834302e3130303435" + - "2e342e332e321001180122483046022100f363cc4813367bdd2fa03c91fc49c3521abf2db86ec8f5836f97f5d13f915285" + - "022100e8a51c68ece56ccc44de41cee75d766adb5f1d688d1773875dc1c6944bc2a1de504b0708a4db7bfc900000008b00" + - "0000504b03041400080808008d4a2f520000000000000000000000000a0000006578706f72742e62696ee3626164666211" + - "32e5e2e060146898fcef3fab103707a3200308dcb8ea20c4cfc104e6386cb9e4a0c0a4c10c9465060b1c5a69e728240bd4" + - "c604d52608d41621e1f3e19e73928304a302b30613d8546674535f34204c6560a8725060d460849bfac18d11622a8b40c3" + - "93c750538376c8b5be0efc602fc104520b00504b070867e7aa477b000000b2000000504b010214001400080808008d4a2f" + - "52a4db7bfc900000008b0000000a00000000000000000000000000000000006578706f72742e736967504b010214001400" + - "080808008d4a2f5267e7aa477b000000b20000000a00000000000000000000000000c80000006578706f72742e62696e50" + - "4b05060000000002000200700000007b0100000000" - ).decodeHex() - private val STATS_PROTO = - ( - "0a040103020412350a080801108093feff05120b0801110000000000d8d540120f0802110000000040b4d24020022803120b08" + - "031100000000c2a93e41121d0a080802108093feff05121108011158184cf0de43624018012003280212350a0808031080" + - "93feff05120b0801110000000000e88040120f0802110000000000007a4020012801120b08031100000000f0460141121d" + - "0a0808041080e4e3ff05121108011152b81e85eb51f03f180220012801" - ).decodeHex().toByteArray() + private val STATS_ZIP = ( + "504b03041400080808008d4a2f520000000000000000000000000a0000006578706f72742e736967018b0074ff0a88010a380a" + + "1864652e726b692e636f726f6e617761726e6170702d6465761a02763122033236322a13312e322e3834302e3130303435" + + "2e342e332e321001180122483046022100f363cc4813367bdd2fa03c91fc49c3521abf2db86ec8f5836f97f5d13f915285" + + "022100e8a51c68ece56ccc44de41cee75d766adb5f1d688d1773875dc1c6944bc2a1de504b0708a4db7bfc900000008b00" + + "0000504b03041400080808008d4a2f520000000000000000000000000a0000006578706f72742e62696ee3626164666211" + + "32e5e2e060146898fcef3fab103707a3200308dcb8ea20c4cfc104e6386cb9e4a0c0a4c10c9465060b1c5a69e728240bd4" + + "c604d52608d41621e1f3e19e73928304a302b30613d8546674535f34204c6560a8725060d460849bfac18d11622a8b40c3" + + "93c750538376c8b5be0efc602fc104520b00504b070867e7aa477b000000b2000000504b010214001400080808008d4a2f" + + "52a4db7bfc900000008b0000000a00000000000000000000000000000000006578706f72742e736967504b010214001400" + + "080808008d4a2f5267e7aa477b000000b20000000a00000000000000000000000000c80000006578706f72742e62696e50" + + "4b05060000000002000200700000007b0100000000" + ).decodeHex() + private val STATS_PROTO = ( + "0a040103020412350a080801108093feff05120b0801110000000000d8d540120f0802110000000040b4d24020022803120b08" + + "031100000000c2a93e41121d0a080802108093feff05121108011158184cf0de43624018012003280212350a0808031080" + + "93feff05120b0801110000000000e88040120f0802110000000000007a4020012801120b08031100000000f0460141121d" + + "0a0808041080e4e3ff05121108011152b81e85eb51f03f180220012801" + ).decodeHex().toByteArray() } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/tracing/ui/settings/TracingSettingsStateTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/tracing/ui/settings/TracingSettingsStateTest.kt index 9c4280d160392da5a01dea4f653a57279c733e2e..cad395181299be2dd95aa471a4d567c676ca94c4 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/tracing/ui/settings/TracingSettingsStateTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/tracing/ui/settings/TracingSettingsStateTest.kt @@ -23,10 +23,14 @@ class TracingSettingsStateTest : BaseTest() { @Test fun `state mapping`() { - GeneralTracingStatus.Status.TRACING_ACTIVE.toTracingSettingsState() shouldBe TracingSettingsState.TracingActive - GeneralTracingStatus.Status.TRACING_INACTIVE.toTracingSettingsState() shouldBe TracingSettingsState.TracingInactive - GeneralTracingStatus.Status.LOCATION_DISABLED.toTracingSettingsState() shouldBe TracingSettingsState.LocationDisabled - GeneralTracingStatus.Status.BLUETOOTH_DISABLED.toTracingSettingsState() shouldBe TracingSettingsState.BluetoothDisabled + GeneralTracingStatus.Status.TRACING_ACTIVE.toTracingSettingsState() shouldBe + TracingSettingsState.TracingActive + GeneralTracingStatus.Status.TRACING_INACTIVE.toTracingSettingsState() shouldBe + TracingSettingsState.TracingInactive + GeneralTracingStatus.Status.LOCATION_DISABLED.toTracingSettingsState() shouldBe + TracingSettingsState.LocationDisabled + GeneralTracingStatus.Status.BLUETOOTH_DISABLED.toTracingSettingsState() shouldBe + TracingSettingsState.BluetoothDisabled } @Test diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/settings/start/SettingsTracingStateTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/settings/start/SettingsTracingStateTest.kt index 3605b67d7cdc38f15732e30c0df9ca3fc35cb85e..a2bd7341ad7bf225a8d5346668fe928c6cb8ed53 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/settings/start/SettingsTracingStateTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/settings/start/SettingsTracingStateTest.kt @@ -24,10 +24,14 @@ class SettingsTracingStateTest : BaseTest() { @Test fun `state mapping`() { - GeneralTracingStatus.Status.TRACING_ACTIVE.toSettingsTracingState() shouldBe SettingsTracingState.TracingActive - GeneralTracingStatus.Status.TRACING_INACTIVE.toSettingsTracingState() shouldBe SettingsTracingState.TracingInActive - GeneralTracingStatus.Status.LOCATION_DISABLED.toSettingsTracingState() shouldBe SettingsTracingState.LocationDisabled - GeneralTracingStatus.Status.BLUETOOTH_DISABLED.toSettingsTracingState() shouldBe SettingsTracingState.BluetoothDisabled + GeneralTracingStatus.Status.TRACING_ACTIVE.toSettingsTracingState() shouldBe + SettingsTracingState.TracingActive + GeneralTracingStatus.Status.TRACING_INACTIVE.toSettingsTracingState() shouldBe + SettingsTracingState.TracingInActive + GeneralTracingStatus.Status.LOCATION_DISABLED.toSettingsTracingState() shouldBe + SettingsTracingState.LocationDisabled + GeneralTracingStatus.Status.BLUETOOTH_DISABLED.toSettingsTracingState() shouldBe + SettingsTracingState.BluetoothDisabled } @Test diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanViewModelTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanViewModelTest.kt index e55f7c2777ed5abd0a8271f455a42084944e0479..46c6931ed6b508af6ac73b82d579a3a623d1dd97 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanViewModelTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/ui/submission/qrcode/scan/SubmissionQRCodeScanViewModelTest.kt @@ -114,7 +114,9 @@ class SubmissionQRCodeScanViewModelTest : BaseTest() { createViewModel().startQrCodeRegistration(rawResult = "", isConsentGiven = true) verify(exactly = 1) { analyticsKeySubmissionCollector.reportAdvancedConsentGiven(CoronaTest.Type.PCR) } - verify(exactly = 0) { analyticsKeySubmissionCollector.reportAdvancedConsentGiven(CoronaTest.Type.RAPID_ANTIGEN) } + verify(exactly = 0) { + analyticsKeySubmissionCollector.reportAdvancedConsentGiven(CoronaTest.Type.RAPID_ANTIGEN) + } } @Test @@ -128,6 +130,8 @@ class SubmissionQRCodeScanViewModelTest : BaseTest() { createViewModel().startQrCodeRegistration(rawResult = "", isConsentGiven = true) verify(exactly = 1) { analyticsKeySubmissionCollector.reportAdvancedConsentGiven(CoronaTest.Type.PCR) } - verify(exactly = 0) { analyticsKeySubmissionCollector.reportAdvancedConsentGiven(CoronaTest.Type.RAPID_ANTIGEN) } + verify(exactly = 0) { + analyticsKeySubmissionCollector.reportAdvancedConsentGiven(CoronaTest.Type.RAPID_ANTIGEN) + } } } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/NoPaddingTestProvider.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/NoPaddingTestProvider.kt index 4630acdca5b4369a3ccce8b1ce703ed4bbf362d8..a7d6cf3de3627ce68aaec58ac09bc5cc9d3e2ac0 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/NoPaddingTestProvider.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/NoPaddingTestProvider.kt @@ -5,6 +5,7 @@ import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.ArgumentsProvider import java.util.stream.Stream +@Suppress("MaxLineLength") class NoPaddingTestProvider : ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { return Stream.of( diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/RetryMechanismTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/RetryMechanismTest.kt index dae2845e53114785f8ef12b0f05c5d1ca5514ff1..888fd03344e13d858f0591af3d95ca3aac980e11 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/RetryMechanismTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/RetryMechanismTest.kt @@ -22,6 +22,7 @@ class RetryMechanismTest : BaseTest() { @BeforeEach fun setup() { MockKAnnotations.init(this) + @Suppress("TooGenericExceptionThrown") every { mockFunction.invoke() } answers { throw RuntimeException(UUID.randomUUID().toString()) } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/WithPaddingTestProvider.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/WithPaddingTestProvider.kt index 0b2bcfef8beb8ac215077df2f1ad33b283d6eb64..576820b24394f9f186343a6060e0d8ce3b43d0f2 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/WithPaddingTestProvider.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/WithPaddingTestProvider.kt @@ -4,7 +4,7 @@ import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.ArgumentsProvider import java.util.stream.Stream - +@Suppress("MaxLineLength") class WithPaddingTestProvider : ArgumentsProvider { override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { return Stream.of( diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterSubmissionHelperTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterSubmissionHelperTest.kt index 14bb4ab063279a7ec43ffa27d230088de0f65fab..7dcb2736b653dfdec54a96503adf239035b2518a 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterSubmissionHelperTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/formatter/FormatterSubmissionHelperTest.kt @@ -42,12 +42,18 @@ class FormatterSubmissionHelperTest : BaseTest() { every { CoronaWarnApplication.getAppContext() } returns context - every { context.getString(R.string.test_result_card_status_positive) } returns R.string.test_result_card_status_positive.toString() - every { context.getString(R.string.test_result_card_status_negative) } returns R.string.test_result_card_status_negative.toString() - every { context.getString(R.string.test_result_card_status_invalid) } returns R.string.test_result_card_status_invalid.toString() - every { context.getString(R.string.test_result_card_virus_name_text) } returns R.string.test_result_card_virus_name_text.toString() - every { context.getString(R.string.test_result_card_status_pending) } returns R.string.test_result_card_status_pending.toString() - every { context.getString(R.string.test_result_card_status_invalid) } returns R.string.test_result_card_status_invalid.toString() + every { context.getString(R.string.test_result_card_status_positive) } returns + R.string.test_result_card_status_positive.toString() + every { context.getString(R.string.test_result_card_status_negative) } returns + R.string.test_result_card_status_negative.toString() + every { context.getString(R.string.test_result_card_status_invalid) } returns + R.string.test_result_card_status_invalid.toString() + every { context.getString(R.string.test_result_card_virus_name_text) } returns + R.string.test_result_card_virus_name_text.toString() + every { context.getString(R.string.test_result_card_status_pending) } returns + R.string.test_result_card_status_pending.toString() + every { context.getString(R.string.test_result_card_status_invalid) } returns + R.string.test_result_card_status_invalid.toString() with(context) { every { getColorCompat(R.color.colorTextSemanticGreen) } returns R.color.colorTextSemanticGreen @@ -64,15 +70,22 @@ class FormatterSubmissionHelperTest : BaseTest() { every { getDrawableCompat(R.drawable.ic_test_result_illustration_negative) } returns drawable } - every { context.getString(R.string.submission_status_card_title_available) } returns R.string.submission_status_card_title_available.toString() - every { context.getString(R.string.submission_status_card_title_pending) } returns R.string.submission_status_card_title_pending.toString() - - every { context.getString(R.string.submission_status_card_body_invalid) } returns R.string.submission_status_card_body_invalid.toString() - every { context.getString(R.string.submission_status_card_body_negative) } returns R.string.submission_status_card_body_negative.toString() - every { context.getString(R.string.submission_status_card_body_positive) } returns R.string.submission_status_card_body_positive.toString() - every { context.getString(R.string.submission_status_card_body_pending) } returns R.string.submission_status_card_body_pending.toString() - - every { context.getString(R.string.submission_status_card_button_show_results) } returns R.string.submission_status_card_button_show_results.toString() + every { context.getString(R.string.submission_status_card_title_available) } returns + R.string.submission_status_card_title_available.toString() + every { context.getString(R.string.submission_status_card_title_pending) } returns + R.string.submission_status_card_title_pending.toString() + + every { context.getString(R.string.submission_status_card_body_invalid) } returns + R.string.submission_status_card_body_invalid.toString() + every { context.getString(R.string.submission_status_card_body_negative) } returns + R.string.submission_status_card_body_negative.toString() + every { context.getString(R.string.submission_status_card_body_positive) } returns + R.string.submission_status_card_body_positive.toString() + every { context.getString(R.string.submission_status_card_body_pending) } returns + R.string.submission_status_card_body_pending.toString() + + every { context.getString(R.string.submission_status_card_button_show_results) } returns + R.string.submission_status_card_button_show_results.toString() } private fun formatTestResultStatusTextBase( @@ -107,7 +120,8 @@ class FormatterSubmissionHelperTest : BaseTest() { every { SpannableStringBuilder().append(any<String>()) } returns spannableStringBuilder1 every { spannableStringBuilder1.append("\n") } returns spannableStringBuilder2 - every { context.getString(R.string.test_result_card_virus_name_text) } returns R.string.test_result_card_virus_name_text.toString() + every { context.getString(R.string.test_result_card_virus_name_text) } returns + R.string.test_result_card_virus_name_text.toString() every { spannableStringBuilder2.append( any<String>(), diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/network/NetworkStateProviderTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/network/NetworkStateProviderTest.kt index 5b7d37f412198e7564d36941d96efe1f72793099..b0e191c7800d3ad3d25732d13d78897985960d83 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/network/NetworkStateProviderTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/network/NetworkStateProviderTest.kt @@ -253,7 +253,9 @@ class NetworkStateProviderTest : BaseTest() { connectivityManager.getLinkProperties(network) connectivityManager.registerNetworkCallback(networkRequest, any<ConnectivityManager.NetworkCallback>()) } - verify(exactly = 0) { connectivityManager.unregisterNetworkCallback(any<ConnectivityManager.NetworkCallback>()) } + verify(exactly = 0) { + connectivityManager.unregisterNetworkCallback(any<ConnectivityManager.NetworkCallback>()) + } } @Test diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/worker/WorkerBinderTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/worker/WorkerBinderTest.kt index 063debf6e86734acf173dd68af3cae32ea7d7548..d5ec4edc888f4f9282dad53a14fea4e194f454fe 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/worker/WorkerBinderTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/util/worker/WorkerBinderTest.kt @@ -83,7 +83,8 @@ class WorkerBinderTest : BaseTest() { @Component(modules = [WorkerBinder::class, MockProvider::class]) interface WorkerTestComponent { - val factories: @JvmSuppressWildcards Map<Class<out ListenableWorker>, Provider<InjectedWorkerFactory<out ListenableWorker>>> + val factories: + @JvmSuppressWildcards Map<Class<out ListenableWorker>, Provider<InjectedWorkerFactory<out ListenableWorker>>> @Component.Factory interface Factory { diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/VaccinationTestData.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/VaccinationTestData.kt index 0c5117d63094019d089ac68493a1edd962fda0cf..5652d7054cc15d06706e37f97a889ad54e6ecc93 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/VaccinationTestData.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/VaccinationTestData.kt @@ -10,6 +10,7 @@ import de.rki.coronawarnapp.vaccination.core.repository.storage.VaccinationConta import org.joda.time.Instant import javax.inject.Inject +@Suppress("MaxLineLength") class VaccinationTestData @Inject constructor( private var qrCodeExtractor: VaccinationQRCodeExtractor, ) { diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/server/valueset/VaccinationServerTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/server/valueset/VaccinationServerTest.kt index 0c27822e117164f0baa327bb8b978c7e72b688b4..1c78f8412ea1d883b5e9881b0e4b79d626959539 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/server/valueset/VaccinationServerTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/vaccination/core/server/valueset/VaccinationServerTest.kt @@ -51,6 +51,7 @@ class VaccinationServerTest : BaseTest() { ) @Test + @Suppress("NestedBlockDepth") fun `valid export data`() { every { signatureValidation.hasValidSignature(any(), any()) } returns true exportZip.inputStream().use { diff --git a/Corona-Warn-App/src/test/java/testhelpers/BaseTest.kt b/Corona-Warn-App/src/test/java/testhelpers/BaseTest.kt index 3eaa6c4c82ca6dd006bcabdd2300744613ed9421..401fa26766d4dcb2821128fb47449dd0c3f6a8cc 100644 --- a/Corona-Warn-App/src/test/java/testhelpers/BaseTest.kt +++ b/Corona-Warn-App/src/test/java/testhelpers/BaseTest.kt @@ -5,6 +5,7 @@ import org.junit.jupiter.api.AfterAll import testhelpers.logging.JUnitTree import timber.log.Timber +@Suppress("UnnecessaryAbstractClass", "UtilityClassWithPublicConstructor") abstract class BaseTest { init { diff --git a/Corona-Warn-App/src/test/java/testhelpers/gms/MockListenableFuture.kt b/Corona-Warn-App/src/test/java/testhelpers/gms/MockListenableFuture.kt index 829b08e38e771b1978216a82399c109cbd49a649..147960fa0a1c580af7fdc4d5e97c68969c80ed2e 100644 --- a/Corona-Warn-App/src/test/java/testhelpers/gms/MockListenableFuture.kt +++ b/Corona-Warn-App/src/test/java/testhelpers/gms/MockListenableFuture.kt @@ -3,7 +3,6 @@ package testhelpers.gms import com.google.common.util.concurrent.ListenableFuture import io.mockk.every import io.mockk.mockk -import java.util.concurrent.Executor object MockListenableFuture { fun <T> forResult(result: T) = mockk<ListenableFuture<T>>().apply { @@ -14,7 +13,6 @@ object MockListenableFuture { every { cancel(any()) } returns true every { addListener(any(), any()) } answers { val listener = arg<Runnable>(0) - val executor = arg<Executor>(1) listener.run() } } diff --git a/Corona-Warn-App/src/testDeviceForTesters/java/de/rki/coronawarnapp/nearby/modules/exposurewindow/ExposureWindowProviderTest.kt b/Corona-Warn-App/src/testDeviceForTesters/java/de/rki/coronawarnapp/nearby/modules/exposurewindow/ExposureWindowProviderTest.kt index 07e494877fd267974e30c263bdc21d783d7267c2..2ea8381d42ee6827660ea67200809ab833a11c20 100644 --- a/Corona-Warn-App/src/testDeviceForTesters/java/de/rki/coronawarnapp/nearby/modules/exposurewindow/ExposureWindowProviderTest.kt +++ b/Corona-Warn-App/src/testDeviceForTesters/java/de/rki/coronawarnapp/nearby/modules/exposurewindow/ExposureWindowProviderTest.kt @@ -35,7 +35,7 @@ class ExposureWindowProviderTest : BaseTestInstrumentation() { @Test fun `fake exposure windows only in tester builds`() { - val instance = createProvider() + createProvider() CWADebug.isDeviceForTestersBuild shouldBe true } } diff --git a/build.gradle b/build.gradle index ac2be459622e89c38d7f0e625aa217afaa6f83fb..9e108b1eec46c28d5926b0b95ea0e377c676be41 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { repositories { google() - jcenter() + mavenCentral() maven { url "https://plugins.gradle.org/m2/" } @@ -17,8 +17,8 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufVersion" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navVersion" - classpath "org.jlleitschuh.gradle:ktlint-gradle:9.4.1" - classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.16.0-RC1" + classpath "org.jlleitschuh.gradle:ktlint-gradle:10.0.0" + classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.17.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -56,7 +56,7 @@ subprojects { allprojects { repositories { google() - jcenter() + mavenCentral() } }