diff options
| author | Kalle Lindström <karl.lindstrom@mullvad.net> | 2024-10-04 12:03:06 +0200 |
|---|---|---|
| committer | David Göransson <david.goransson@mullvad.net> | 2024-10-07 08:34:52 +0200 |
| commit | cd084f800055a344262e5100d24ebeb500860e83 (patch) | |
| tree | 5b5d00686dd2e4241d99aefb1d80ab2035b8ff81 /android/app/src/test | |
| parent | 2912d6f8c9b535711a98a52e0c1285f4db6d6a48 (diff) | |
| download | mullvadvpn-cd084f800055a344262e5100d24ebeb500860e83.tar.xz mullvadvpn-cd084f800055a344262e5100d24ebeb500860e83.zip | |
Use Duration instead of Period
Diffstat (limited to 'android/app/src/test')
2 files changed, 7 insertions, 8 deletions
diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt index 07c6c2ed13..74b599da97 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.usecase.AccountExpiryInAppNotificationUseCase import net.mullvad.mullvadvpn.usecase.NewDeviceNotificationUseCase import net.mullvad.mullvadvpn.usecase.TunnelStateNotificationUseCase import net.mullvad.mullvadvpn.usecase.VersionNotificationUseCase -import org.joda.time.Period +import org.joda.time.Duration import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -81,7 +81,7 @@ class InAppNotificationControllerTest { val unsupportedVersion = InAppNotification.UnsupportedVersion(mockk()) versionNotifications.value = listOf(unsupportedVersion) - val accountExpiry = InAppNotification.AccountExpiry(Period.ZERO) + val accountExpiry = InAppNotification.AccountExpiry(Duration.ZERO) accountExpiryNotifications.value = listOf(accountExpiry) inAppNotificationController.notifications.test { diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCaseTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCaseTest.kt index 344d2fe701..0749cc62b4 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCaseTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryInAppNotificationUseCaseTest.kt @@ -117,7 +117,7 @@ class AccountExpiryInAppNotificationUseCaseTest { advanceTimeBy(ACCOUNT_EXPIRY_IN_APP_NOTIFICATION_UPDATE_INTERVAL.millis) // Advance past the delay after the while loop: advanceTimeBy(ACCOUNT_EXPIRY_IN_APP_NOTIFICATION_UPDATE_INTERVAL.millis) - assertEquals(Period.ZERO, getExpiryNotificationPeriod(expectMostRecentItem())) + assertEquals(Duration.ZERO, getExpiryNotificationDuration(expectMostRecentItem())) expectNoEvents() } } @@ -134,16 +134,15 @@ class AccountExpiryInAppNotificationUseCaseTest { expiry: DateTime, notifications: List<InAppNotification>, ) { - val notificationPeriod = getExpiryNotificationPeriod(notifications) + val notificationDuration = getExpiryNotificationDuration(notifications) val periodNow = Period(DateTime.now(), expiry) - assertTrue(periodNow.toStandardDuration() <= notificationPeriod.toStandardDuration()) + assertTrue(periodNow.toStandardDuration() <= notificationDuration) assertTrue( - periodNow.toStandardDuration().plus(Duration.standardSeconds(5)) > - notificationPeriod.toStandardDuration() + periodNow.toStandardDuration().plus(Duration.standardSeconds(5)) > notificationDuration ) } - private fun getExpiryNotificationPeriod(notifications: List<InAppNotification>): Period { + private fun getExpiryNotificationDuration(notifications: List<InAppNotification>): Duration { assertTrue(notifications.size == 1, "Expected a single notification") val n = notifications[0] if (n !is InAppNotification.AccountExpiry) { |
