diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManagerTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManagerTest.kt index a8058fbcc5..b84e7b4be3 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManagerTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManagerTest.kt @@ -23,10 +23,10 @@ import io.element.android.libraries.matrix.test.A_SPACE_ID import io.element.android.libraries.matrix.test.A_THREAD_ID import io.element.android.libraries.matrix.test.FakeMatrixClientProvider import io.element.android.libraries.matrix.test.core.aBuildMeta -import io.element.android.libraries.push.impl.notifications.fake.FakeNotificationCreator import io.element.android.libraries.push.impl.notifications.fake.FakeImageLoaderHolder -import io.element.android.libraries.push.impl.notifications.fake.FakeRoomGroupMessageCreator -import io.element.android.libraries.push.impl.notifications.fake.FakeSummaryGroupMessageCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkNotificationCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkRoomGroupMessageCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkSummaryGroupMessageCreator import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent import io.element.android.services.appnavstate.api.AppNavigationState @@ -115,12 +115,12 @@ class DefaultNotificationDrawerManagerTest { appNavigationStateService = appNavigationStateService ), notificationRenderer = NotificationRenderer( - NotificationIdProvider(), - NotificationDisplayer(context), - NotificationFactory( - FakeNotificationCreator().instance, - FakeRoomGroupMessageCreator().instance, - FakeSummaryGroupMessageCreator().instance, + notificationIdProvider = NotificationIdProvider(), + notificationDisplayer = NotificationDisplayer(context), + notificationFactory = NotificationFactory( + notificationCreator = MockkNotificationCreator().instance, + roomGroupMessageCreator = MockkRoomGroupMessageCreator().instance, + summaryGroupMessageCreator = MockkSummaryGroupMessageCreator().instance, ) ), notificationEventPersistence = InMemoryNotificationEventPersistence(initialData = initialData), diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventProcessorTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventProcessorTest.kt index 02da10a351..a8626766e5 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventProcessorTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventProcessorTest.kt @@ -25,7 +25,7 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID_2 import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.A_SPACE_ID import io.element.android.libraries.matrix.test.A_THREAD_ID -import io.element.android.libraries.push.impl.notifications.fake.FakeOutdatedEventDetector +import io.element.android.libraries.push.impl.notifications.fake.MockkOutdatedEventDetector import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent import io.element.android.libraries.push.impl.notifications.fixtures.aSimpleNotifiableEvent import io.element.android.libraries.push.impl.notifications.fixtures.anInviteNotifiableEvent @@ -42,7 +42,7 @@ private val VIEWING_A_ROOM = aNavigationState(A_SESSION_ID, A_SPACE_ID, A_ROOM_I private val VIEWING_A_THREAD = aNavigationState(A_SESSION_ID, A_SPACE_ID, A_ROOM_ID, A_THREAD_ID) class NotifiableEventProcessorTest { - private val outdatedDetector = FakeOutdatedEventDetector() + private val mockkOutdatedDetector = MockkOutdatedEventDetector() @Test fun `given simple events when processing then keep simple events`() { @@ -97,7 +97,7 @@ class NotifiableEventProcessorTest { @Test fun `given out of date message event when processing then removes message event`() { val events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID, roomId = A_ROOM_ID)) - outdatedDetector.givenEventIsOutOfDate(events[0]) + mockkOutdatedDetector.givenEventIsOutOfDate(events[0]) val eventProcessor = createProcessor(navigationState = NOT_VIEWING_A_ROOM) @@ -113,7 +113,7 @@ class NotifiableEventProcessorTest { @Test fun `given in date message event when processing then keep message event`() { val events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID, roomId = A_ROOM_ID)) - outdatedDetector.givenEventIsInDate(events[0]) + mockkOutdatedDetector.givenEventIsInDate(events[0]) val eventProcessor = createProcessor(navigationState = NOT_VIEWING_A_ROOM) val result = eventProcessor.process(events, renderedEvents = emptyList()) @@ -128,7 +128,7 @@ class NotifiableEventProcessorTest { @Test fun `given viewing the same room main timeline when processing main timeline message event then removes message`() { val events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID, roomId = A_ROOM_ID, threadId = null)) - events.forEach { outdatedDetector.givenEventIsOutOfDate(it) } + events.forEach { mockkOutdatedDetector.givenEventIsOutOfDate(it) } val eventProcessor = createProcessor(isInForeground = true, navigationState = VIEWING_A_ROOM) val result = eventProcessor.process(events, renderedEvents = emptyList()) @@ -143,7 +143,7 @@ class NotifiableEventProcessorTest { @Test fun `given viewing the same thread timeline when processing thread message event then removes message`() { val events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID, roomId = A_ROOM_ID, threadId = A_THREAD_ID)) - events.forEach { outdatedDetector.givenEventIsOutOfDate(it) } + events.forEach { mockkOutdatedDetector.givenEventIsOutOfDate(it) } val eventProcessor = createProcessor(isInForeground = true, navigationState = VIEWING_A_THREAD) val result = eventProcessor.process(events, renderedEvents = emptyList()) @@ -158,7 +158,7 @@ class NotifiableEventProcessorTest { @Test fun `given viewing main timeline of the same room when processing thread timeline message event then keep message`() { val events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID, roomId = A_ROOM_ID, threadId = A_THREAD_ID)) - outdatedDetector.givenEventIsInDate(events[0]) + mockkOutdatedDetector.givenEventIsInDate(events[0]) val eventProcessor = createProcessor(isInForeground = true, navigationState = VIEWING_A_ROOM) val result = eventProcessor.process(events, renderedEvents = emptyList()) @@ -173,7 +173,7 @@ class NotifiableEventProcessorTest { @Test fun `given viewing thread timeline of the same room when processing main timeline message event then keep message`() { val events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID, roomId = A_ROOM_ID)) - outdatedDetector.givenEventIsInDate(events[0]) + mockkOutdatedDetector.givenEventIsInDate(events[0]) val eventProcessor = createProcessor(isInForeground = true, navigationState = VIEWING_A_THREAD) val result = eventProcessor.process(events, renderedEvents = emptyList()) @@ -213,8 +213,8 @@ class NotifiableEventProcessorTest { navigationState: NavigationState ): NotifiableEventProcessor { return NotifiableEventProcessor( - outdatedDetector.instance, - FakeAppNavigationStateService(MutableStateFlow(AppNavigationState(navigationState, isInForeground))), + outdatedDetector = mockkOutdatedDetector.instance, + appNavigationStateService = FakeAppNavigationStateService(MutableStateFlow(AppNavigationState(navigationState, isInForeground))), ) } } diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationFactoryTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationFactoryTest.kt index cd1d19b3a7..6a211fc446 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationFactoryTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationFactoryTest.kt @@ -22,10 +22,10 @@ import io.element.android.libraries.matrix.api.user.MatrixUser import io.element.android.libraries.matrix.test.AN_EVENT_ID import io.element.android.libraries.matrix.test.A_ROOM_ID import io.element.android.libraries.matrix.test.A_SESSION_ID -import io.element.android.libraries.push.impl.notifications.fake.FakeNotificationCreator import io.element.android.libraries.push.impl.notifications.fake.FakeImageLoader -import io.element.android.libraries.push.impl.notifications.fake.FakeRoomGroupMessageCreator -import io.element.android.libraries.push.impl.notifications.fake.FakeSummaryGroupMessageCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkNotificationCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkRoomGroupMessageCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkSummaryGroupMessageCreator import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent import io.element.android.libraries.push.impl.notifications.fixtures.aSimpleNotifiableEvent import io.element.android.libraries.push.impl.notifications.fixtures.anInviteNotifiableEvent @@ -41,19 +41,19 @@ private val A_MESSAGE_EVENT = aNotifiableMessageEvent(eventId = AN_EVENT_ID, roo @RunWith(RobolectricTestRunner::class) class NotificationFactoryTest { - private val androidNotificationFactory = FakeNotificationCreator() - private val roomGroupMessageCreator = FakeRoomGroupMessageCreator() - private val summaryGroupMessageCreator = FakeSummaryGroupMessageCreator() + private val mockkNotificationCreator = MockkNotificationCreator() + private val mockkRoomGroupMessageCreator = MockkRoomGroupMessageCreator() + private val mockkSummaryGroupMessageCreator = MockkSummaryGroupMessageCreator() private val notificationFactory = NotificationFactory( - androidNotificationFactory.instance, - roomGroupMessageCreator.instance, - summaryGroupMessageCreator.instance + notificationCreator = mockkNotificationCreator.instance, + roomGroupMessageCreator = mockkRoomGroupMessageCreator.instance, + summaryGroupMessageCreator = mockkSummaryGroupMessageCreator.instance ) @Test fun `given a room invitation when mapping to notification then is Append`() = testWith(notificationFactory) { - val expectedNotification = androidNotificationFactory.givenCreateRoomInvitationNotificationFor(AN_INVITATION_EVENT) + val expectedNotification = mockkNotificationCreator.givenCreateRoomInvitationNotificationFor(AN_INVITATION_EVENT) val roomInvitation = listOf(ProcessedEvent(ProcessedEvent.Type.KEEP, AN_INVITATION_EVENT)) val result = roomInvitation.toNotifications() @@ -90,7 +90,7 @@ class NotificationFactoryTest { @Test fun `given a simple event when mapping to notification then is Append`() = testWith(notificationFactory) { - val expectedNotification = androidNotificationFactory.givenCreateSimpleInvitationNotificationFor(A_SIMPLE_EVENT) + val expectedNotification = mockkNotificationCreator.givenCreateSimpleInvitationNotificationFor(A_SIMPLE_EVENT) val roomInvitation = listOf(ProcessedEvent(ProcessedEvent.Type.KEEP, A_SIMPLE_EVENT)) val result = roomInvitation.toNotifications() @@ -128,7 +128,7 @@ class NotificationFactoryTest { @Test fun `given room with message when mapping to notification then delegates to room group message creator`() = testWith(notificationFactory) { val events = listOf(A_MESSAGE_EVENT) - val expectedNotification = roomGroupMessageCreator.givenCreatesRoomMessageFor( + val expectedNotification = mockkRoomGroupMessageCreator.givenCreatesRoomMessageFor( MatrixUser(A_SESSION_ID, A_SESSION_ID.value, MY_AVATAR_URL), events, A_ROOM_ID @@ -197,7 +197,7 @@ class NotificationFactoryTest { ) ) val withRedactedRemoved = listOf(A_MESSAGE_EVENT.copy(eventId = EventId("\$not-redacted"))) - val expectedNotification = roomGroupMessageCreator.givenCreatesRoomMessageFor( + val expectedNotification = mockkRoomGroupMessageCreator.givenCreatesRoomMessageFor( MatrixUser(A_SESSION_ID, A_SESSION_ID.value, MY_AVATAR_URL), withRedactedRemoved, A_ROOM_ID, diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRendererTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRendererTest.kt index 4780ae3914..21fc1b4fca 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRendererTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/NotificationRendererTest.kt @@ -22,8 +22,8 @@ import io.element.android.libraries.matrix.test.AN_EVENT_ID import io.element.android.libraries.matrix.test.A_ROOM_ID import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.push.impl.notifications.fake.FakeImageLoader -import io.element.android.libraries.push.impl.notifications.fake.FakeNotificationDisplayer -import io.element.android.libraries.push.impl.notifications.fake.FakeNotificationFactory +import io.element.android.libraries.push.impl.notifications.fake.MockkNotificationDisplayer +import io.element.android.libraries.push.impl.notifications.fake.MockkNotificationFactory import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent import io.mockk.mockk import kotlinx.coroutines.test.runTest @@ -51,14 +51,14 @@ private val ONE_SHOT_META = OneShotNotification.Append.Meta(key = "ignored", sum @RunWith(RobolectricTestRunner::class) class NotificationRendererTest { - private val notificationDisplayer = FakeNotificationDisplayer() - private val notificationFactory = FakeNotificationFactory() + private val mockkNotificationDisplayer = MockkNotificationDisplayer() + private val mockkNotificationFactory = MockkNotificationFactory() private val notificationIdProvider = NotificationIdProvider() private val notificationRenderer = NotificationRenderer( notificationIdProvider = notificationIdProvider, - notificationDisplayer = notificationDisplayer.instance, - notificationFactory = notificationFactory.instance, + notificationDisplayer = mockkNotificationDisplayer.instance, + notificationFactory = mockkNotificationFactory.instance, ) @Test @@ -67,8 +67,8 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifySummaryCancelled() - notificationDisplayer.verifyNoOtherInteractions() + mockkNotificationDisplayer.verifySummaryCancelled() + mockkNotificationDisplayer.verifyNoOtherInteractions() } @Test @@ -77,7 +77,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { cancelNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID)) cancelNotificationMessage(tag = A_ROOM_ID.value, notificationIdProvider.getRoomMessagesNotificationId(A_SESSION_ID)) } @@ -89,7 +89,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { cancelNotificationMessage(tag = A_ROOM_ID.value, notificationIdProvider.getRoomMessagesNotificationId(A_SESSION_ID)) showNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), A_SUMMARY_NOTIFICATION.notification) } @@ -108,7 +108,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { showNotificationMessage(tag = A_ROOM_ID.value, notificationIdProvider.getRoomMessagesNotificationId(A_SESSION_ID), A_NOTIFICATION) showNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), A_SUMMARY_NOTIFICATION.notification) } @@ -120,7 +120,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { cancelNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID)) cancelNotificationMessage(tag = AN_EVENT_ID.value, notificationIdProvider.getRoomEventNotificationId(A_SESSION_ID)) } @@ -132,7 +132,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { cancelNotificationMessage(tag = AN_EVENT_ID.value, notificationIdProvider.getRoomEventNotificationId(A_SESSION_ID)) showNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), A_SUMMARY_NOTIFICATION.notification) } @@ -151,7 +151,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { showNotificationMessage(tag = AN_EVENT_ID.value, notificationIdProvider.getRoomEventNotificationId(A_SESSION_ID), A_NOTIFICATION) showNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), A_SUMMARY_NOTIFICATION.notification) } @@ -163,7 +163,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { cancelNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID)) cancelNotificationMessage(tag = A_ROOM_ID.value, notificationIdProvider.getRoomInvitationNotificationId(A_SESSION_ID)) } @@ -175,7 +175,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { cancelNotificationMessage(tag = A_ROOM_ID.value, notificationIdProvider.getRoomInvitationNotificationId(A_SESSION_ID)) showNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), A_SUMMARY_NOTIFICATION.notification) } @@ -194,7 +194,7 @@ class NotificationRendererTest { renderEventsAsNotifications() - notificationDisplayer.verifyInOrder { + mockkNotificationDisplayer.verifyInOrder { showNotificationMessage(tag = A_ROOM_ID.value, notificationIdProvider.getRoomEventNotificationId(A_SESSION_ID), A_NOTIFICATION) showNotificationMessage(tag = null, notificationIdProvider.getSummaryNotificationId(A_SESSION_ID), A_SUMMARY_NOTIFICATION.notification) } @@ -221,7 +221,7 @@ class NotificationRendererTest { useCompleteNotificationFormat: Boolean = USE_COMPLETE_NOTIFICATION_FORMAT, summaryNotification: SummaryNotification = A_SUMMARY_NOTIFICATION ) { - notificationFactory.givenNotificationsFor( + mockkNotificationFactory.givenNotificationsFor( groupedEvents = A_PROCESSED_EVENTS, matrixUser = MatrixUser(A_SESSION_ID, MY_USER_DISPLAY_NAME, MY_USER_AVATAR_URL), useCompleteNotificationFormat = useCompleteNotificationFormat, diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationCreator.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationCreator.kt similarity index 98% rename from libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationCreator.kt rename to libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationCreator.kt index 5029166f06..205ba058e6 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationCreator.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationCreator.kt @@ -23,7 +23,7 @@ import io.element.android.libraries.push.impl.notifications.model.SimpleNotifiab import io.mockk.every import io.mockk.mockk -class FakeNotificationCreator { +class MockkNotificationCreator { val instance = mockk() fun givenCreateRoomInvitationNotificationFor(event: InviteNotifiableEvent): Notification { diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationDisplayer.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationDisplayer.kt similarity index 97% rename from libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationDisplayer.kt rename to libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationDisplayer.kt index d737c8eae2..dc55cecfac 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationDisplayer.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationDisplayer.kt @@ -25,7 +25,7 @@ import io.mockk.mockk import io.mockk.verify import io.mockk.verifyOrder -class FakeNotificationDisplayer { +class MockkNotificationDisplayer { val instance = mockk(relaxed = true) fun givenDisplayDiagnosticNotificationResult(result: Boolean) { diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationFactory.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationFactory.kt similarity index 98% rename from libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationFactory.kt rename to libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationFactory.kt index 9c7755aa9d..6a8410d2cb 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeNotificationFactory.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkNotificationFactory.kt @@ -26,7 +26,7 @@ import io.mockk.coEvery import io.mockk.every import io.mockk.mockk -class FakeNotificationFactory { +class MockkNotificationFactory { val instance = mockk() fun givenNotificationsFor( diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeOutdatedEventDetector.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkOutdatedEventDetector.kt similarity index 97% rename from libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeOutdatedEventDetector.kt rename to libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkOutdatedEventDetector.kt index 03bf7e8491..414f7ae652 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeOutdatedEventDetector.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkOutdatedEventDetector.kt @@ -21,7 +21,7 @@ import io.element.android.libraries.push.impl.notifications.model.NotifiableEven import io.mockk.every import io.mockk.mockk -class FakeOutdatedEventDetector { +class MockkOutdatedEventDetector { val instance = mockk() fun givenEventIsOutOfDate(notifiableEvent: NotifiableEvent) { diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeRoomGroupMessageCreator.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkRoomGroupMessageCreator.kt similarity index 97% rename from libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeRoomGroupMessageCreator.kt rename to libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkRoomGroupMessageCreator.kt index a41a4aadc2..389a4f441d 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeRoomGroupMessageCreator.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkRoomGroupMessageCreator.kt @@ -24,7 +24,7 @@ import io.element.android.libraries.push.impl.notifications.model.NotifiableMess import io.mockk.coEvery import io.mockk.mockk -class FakeRoomGroupMessageCreator { +class MockkRoomGroupMessageCreator { val instance = mockk() fun givenCreatesRoomMessageFor( diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeSummaryGroupMessageCreator.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkSummaryGroupMessageCreator.kt similarity index 95% rename from libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeSummaryGroupMessageCreator.kt rename to libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkSummaryGroupMessageCreator.kt index 546cb1e054..8f99651c89 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/FakeSummaryGroupMessageCreator.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/fake/MockkSummaryGroupMessageCreator.kt @@ -19,6 +19,6 @@ package io.element.android.libraries.push.impl.notifications.fake import io.element.android.libraries.push.impl.notifications.SummaryGroupMessageCreator import io.mockk.mockk -class FakeSummaryGroupMessageCreator { +class MockkSummaryGroupMessageCreator { val instance = mockk() } diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/NotificationTestTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/NotificationTestTest.kt index fcef1dcbab..0a4ac2d066 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/NotificationTestTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/NotificationTestTest.kt @@ -19,17 +19,17 @@ package io.element.android.libraries.push.impl.troubleshoot import app.cash.turbine.test import com.google.common.truth.Truth.assertThat import io.element.android.libraries.core.notifications.NotificationTroubleshootTestState -import io.element.android.libraries.push.impl.notifications.fake.FakeNotificationCreator -import io.element.android.libraries.push.impl.notifications.fake.FakeNotificationDisplayer +import io.element.android.libraries.push.impl.notifications.fake.MockkNotificationCreator +import io.element.android.libraries.push.impl.notifications.fake.MockkNotificationDisplayer import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest import org.junit.Test class NotificationTestTest { - private val fakeNotificationCreator = FakeNotificationCreator().apply { + private val mockkNotificationCreator = MockkNotificationCreator().apply { givenCreateDiagnosticNotification() } - private val fakeNotificationDisplayer = FakeNotificationDisplayer().apply { + private val mockkNotificationDisplayer = MockkNotificationDisplayer().apply { givenDisplayDiagnosticNotificationResult(true) } @@ -37,7 +37,7 @@ class NotificationTestTest { @Test fun `test NotificationTest notification cannot be displayed`() = runTest { - fakeNotificationDisplayer.givenDisplayDiagnosticNotificationResult(false) + mockkNotificationDisplayer.givenDisplayDiagnosticNotificationResult(false) val sut = createNotificationTest() launch { sut.run(this) @@ -80,8 +80,8 @@ class NotificationTestTest { private fun createNotificationTest(): NotificationTest { return NotificationTest( - notificationCreator = fakeNotificationCreator.instance, - notificationDisplayer = fakeNotificationDisplayer.instance, + notificationCreator = mockkNotificationCreator.instance, + notificationDisplayer = mockkNotificationDisplayer.instance, notificationClickHandler = notificationClickHandler ) }