Merge pull request #5739 from k9mail/refactor_notification_code

Refactor notification code
This commit is contained in:
cketti 2021-10-15 18:36:48 +02:00 committed by GitHub
commit b8700b9dce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 227 additions and 181 deletions

View file

@ -5,7 +5,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.fsck.k9.Account
internal open class AuthenticationErrorNotifications(
internal open class AuthenticationErrorNotificationController(
private val notificationHelper: NotificationHelper,
private val actionCreator: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider

View file

@ -5,7 +5,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.fsck.k9.Account
internal open class CertificateErrorNotifications(
internal open class CertificateErrorNotificationController(
private val notificationHelper: NotificationHelper,
private val actionCreator: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider

View file

@ -8,15 +8,23 @@ import java.util.concurrent.Executors
import org.koin.dsl.module
val coreNotificationModule = module {
single { NotificationController(get(), get(), get(), get(), get()) }
single {
NotificationController(
certificateErrorNotificationController = get(),
authenticationErrorNotificationController = get(),
syncNotificationController = get(),
sendFailedNotificationController = get(),
newMailNotificationController = get()
)
}
single { NotificationManagerCompat.from(get()) }
single { NotificationHelper(get(), get(), get()) }
single { NotificationHelper(context = get(), notificationManager = get(), channelUtils = get()) }
single {
NotificationChannelManager(
get(),
Executors.newSingleThreadExecutor(),
get<Context>().getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager,
get()
preferences = get(),
backgroundExecutor = Executors.newSingleThreadExecutor(),
notificationManager = get<Context>().getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager,
resourceProvider = get()
)
}
single {
@ -26,15 +34,53 @@ val coreNotificationModule = module {
serverSettingsSerializer = get()
)
}
single { CertificateErrorNotifications(get(), get(), get()) }
single { AuthenticationErrorNotifications(get(), get(), get()) }
single { SyncNotifications(get(), get(), get()) }
single { SendFailedNotifications(get(), get(), get()) }
single { NewMailNotifications(get(), get(), get(), get()) }
single { NotificationContentCreator(get(), get()) }
single { SingleMessageNotifications(get(), get(), get(), get()) }
single { MessageSummaryNotifications(get(), get(), get(), get(), get()) }
single { LockScreenNotification(get(), get()) }
single {
CertificateErrorNotificationController(
notificationHelper = get(),
actionCreator = get(),
resourceProvider = get()
)
}
single {
AuthenticationErrorNotificationController(
notificationHelper = get(),
actionCreator = get(),
resourceProvider = get()
)
}
single {
SyncNotificationController(notificationHelper = get(), actionBuilder = get(), resourceProvider = get())
}
single {
SendFailedNotificationController(notificationHelper = get(), actionBuilder = get(), resourceProvider = get())
}
single {
NewMailNotificationController(
notificationHelper = get(),
contentCreator = get(),
summaryNotificationCreator = get(),
singleMessageNotificationCreator = get()
)
}
single { NotificationContentCreator(context = get(), resourceProvider = get()) }
single {
SingleMessageNotificationCreator(
notificationHelper = get(),
actionCreator = get(),
resourceProvider = get(),
lockScreenNotificationCreator = get()
)
}
single {
SummaryNotificationCreator(
notificationHelper = get(),
actionCreator = get(),
lockScreenNotificationCreator = get(),
singleMessageNotificationCreator = get(),
resourceProvider = get()
)
}
single { LockScreenNotificationCreator(notificationHelper = get(), resourceProvider = get()) }
single {
PushNotificationManager(
context = get(),

View file

@ -5,7 +5,7 @@ import androidx.core.app.NotificationCompat
import com.fsck.k9.K9
import com.fsck.k9.K9.LockScreenNotificationVisibility
internal class LockScreenNotification(
internal class LockScreenNotificationCreator(
private val notificationHelper: NotificationHelper,
private val resourceProvider: NotificationResourceProvider
) {

View file

@ -9,11 +9,11 @@ import com.fsck.k9.mailstore.LocalMessage
/**
* Handle notifications for new messages.
*/
internal open class NewMailNotifications(
internal open class NewMailNotificationController(
private val notificationHelper: NotificationHelper,
private val contentCreator: NotificationContentCreator,
private val messageSummaryNotifications: MessageSummaryNotifications,
private val singleMessageNotifications: SingleMessageNotifications
private val summaryNotificationCreator: SummaryNotificationCreator,
private val singleMessageNotificationCreator: SingleMessageNotificationCreator
) {
private val notifications = SparseArray<NotificationData>()
private val lock = Any()
@ -110,13 +110,13 @@ internal open class NewMailNotifications(
}
private fun createSummaryNotification(account: Account, notificationData: NotificationData, silent: Boolean) {
val notification = messageSummaryNotifications.buildSummaryNotification(account, notificationData, silent)
val notification = summaryNotificationCreator.buildSummaryNotification(account, notificationData, silent)
val notificationId = NotificationIds.getNewMailSummaryNotificationId(account)
notificationManager.notify(notificationId, notification)
}
private fun createSingleMessageNotification(account: Account, holder: NotificationHolder) {
val notification = singleMessageNotifications.buildSingleMessageNotification(account, holder)
val notification = singleMessageNotificationCreator.buildSingleMessageNotification(account, holder)
val notificationId = holder.notificationId
notificationManager.notify(notificationId, notification)
}
@ -128,7 +128,7 @@ internal open class NewMailNotifications(
notificationData: NotificationData
) {
val holder = notificationData.holderForLatestNotification
val notification = singleMessageNotifications.buildSingleMessageNotificationWithLockScreenNotification(
val notification = singleMessageNotificationCreator.buildSingleMessageNotificationWithLockScreenNotification(
account,
holder,
notificationData

View file

@ -6,65 +6,65 @@ import com.fsck.k9.mailstore.LocalFolder
import com.fsck.k9.mailstore.LocalMessage
class NotificationController internal constructor(
private val certificateErrorNotifications: CertificateErrorNotifications,
private val authenticationErrorNotifications: AuthenticationErrorNotifications,
private val syncNotifications: SyncNotifications,
private val sendFailedNotifications: SendFailedNotifications,
private val newMailNotifications: NewMailNotifications
private val certificateErrorNotificationController: CertificateErrorNotificationController,
private val authenticationErrorNotificationController: AuthenticationErrorNotificationController,
private val syncNotificationController: SyncNotificationController,
private val sendFailedNotificationController: SendFailedNotificationController,
private val newMailNotificationController: NewMailNotificationController
) {
fun showCertificateErrorNotification(account: Account, incoming: Boolean) {
certificateErrorNotifications.showCertificateErrorNotification(account, incoming)
certificateErrorNotificationController.showCertificateErrorNotification(account, incoming)
}
fun clearCertificateErrorNotifications(account: Account, incoming: Boolean) {
certificateErrorNotifications.clearCertificateErrorNotifications(account, incoming)
certificateErrorNotificationController.clearCertificateErrorNotifications(account, incoming)
}
fun showAuthenticationErrorNotification(account: Account, incoming: Boolean) {
authenticationErrorNotifications.showAuthenticationErrorNotification(account, incoming)
authenticationErrorNotificationController.showAuthenticationErrorNotification(account, incoming)
}
fun clearAuthenticationErrorNotification(account: Account, incoming: Boolean) {
authenticationErrorNotifications.clearAuthenticationErrorNotification(account, incoming)
authenticationErrorNotificationController.clearAuthenticationErrorNotification(account, incoming)
}
fun showSendingNotification(account: Account) {
syncNotifications.showSendingNotification(account)
syncNotificationController.showSendingNotification(account)
}
fun clearSendingNotification(account: Account) {
syncNotifications.clearSendingNotification(account)
syncNotificationController.clearSendingNotification(account)
}
fun showSendFailedNotification(account: Account, exception: Exception) {
sendFailedNotifications.showSendFailedNotification(account, exception)
sendFailedNotificationController.showSendFailedNotification(account, exception)
}
fun clearSendFailedNotification(account: Account) {
sendFailedNotifications.clearSendFailedNotification(account)
sendFailedNotificationController.clearSendFailedNotification(account)
}
fun showFetchingMailNotification(account: Account, folder: LocalFolder) {
syncNotifications.showFetchingMailNotification(account, folder)
syncNotificationController.showFetchingMailNotification(account, folder)
}
fun showEmptyFetchingMailNotification(account: Account) {
syncNotifications.showEmptyFetchingMailNotification(account)
syncNotificationController.showEmptyFetchingMailNotification(account)
}
fun clearFetchingMailNotification(account: Account) {
syncNotifications.clearFetchingMailNotification(account)
syncNotificationController.clearFetchingMailNotification(account)
}
fun addNewMailNotification(account: Account, message: LocalMessage, silent: Boolean) {
newMailNotifications.addNewMailNotification(account, message, silent)
newMailNotificationController.addNewMailNotification(account, message, silent)
}
fun removeNewMailNotification(account: Account, messageReference: MessageReference) {
newMailNotifications.removeNewMailNotification(account, messageReference)
newMailNotificationController.removeNewMailNotification(account, messageReference)
}
fun clearNewMailNotifications(account: Account) {
newMailNotifications.clearNewMailNotifications(account)
newMailNotificationController.clearNewMailNotifications(account)
}
}

View file

@ -5,7 +5,7 @@ import androidx.core.app.NotificationManagerCompat
import com.fsck.k9.Account
import com.fsck.k9.helper.ExceptionHelper
internal class SendFailedNotifications(
internal class SendFailedNotificationController(
private val notificationHelper: NotificationHelper,
private val actionBuilder: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider

View file

@ -6,11 +6,11 @@ import com.fsck.k9.Account
import com.fsck.k9.K9
import com.fsck.k9.notification.NotificationChannelManager.ChannelType
internal open class SingleMessageNotifications(
internal open class SingleMessageNotificationCreator(
private val notificationHelper: NotificationHelper,
private val actionCreator: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider,
private val lockScreenNotification: LockScreenNotification,
private val lockScreenNotificationCreator: LockScreenNotificationCreator,
) {
fun buildSingleMessageNotification(account: Account, holder: NotificationHolder): Notification {
@ -29,7 +29,7 @@ internal open class SingleMessageNotifications(
return createSingleMessageNotificationBuilder(account, holder, notificationId)
.setNotificationSilent()
.apply {
lockScreenNotification.configureLockScreenNotification(this, notificationData)
lockScreenNotificationCreator.configureLockScreenNotification(this, notificationData)
}
.build()
}

View file

@ -9,11 +9,11 @@ import com.fsck.k9.notification.NotificationChannelManager.ChannelType
import com.fsck.k9.notification.NotificationGroupKeys.getGroupKey
import com.fsck.k9.notification.NotificationIds.getNewMailSummaryNotificationId
internal open class MessageSummaryNotifications(
internal open class SummaryNotificationCreator(
private val notificationHelper: NotificationHelper,
private val actionCreator: NotificationActionCreator,
private val lockScreenNotification: LockScreenNotification,
private val singleMessageNotifications: SingleMessageNotifications,
private val lockScreenNotificationCreator: LockScreenNotificationCreator,
private val singleMessageNotificationCreator: SingleMessageNotificationCreator,
private val resourceProvider: NotificationResourceProvider
) {
@ -36,7 +36,7 @@ internal open class MessageSummaryNotifications(
val deletePendingIntent = actionCreator.createDismissAllMessagesPendingIntent(account, notificationId)
builder.setDeleteIntent(deletePendingIntent)
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
lockScreenNotificationCreator.configureLockScreenNotification(builder, notificationData)
val notificationSetting = account.notificationSetting
notificationHelper.configureNotification(
@ -56,7 +56,7 @@ internal open class MessageSummaryNotifications(
holder: NotificationHolder
): NotificationCompat.Builder {
val notificationId = getNewMailSummaryNotificationId(account)
val builder = singleMessageNotifications.createSingleMessageNotificationBuilder(account, holder, notificationId)
val builder = singleMessageNotificationCreator.createSingleMessageNotificationBuilder(account, holder, notificationId)
builder.setGroupSummary(true)
return builder

View file

@ -7,7 +7,7 @@ import com.fsck.k9.mailstore.LocalFolder
private const val NOTIFICATION_LED_WHILE_SYNCING = false
internal class SyncNotifications(
internal class SyncNotificationController(
private val notificationHelper: NotificationHelper,
private val actionBuilder: NotificationActionCreator,
private val resourceProvider: NotificationResourceProvider

View file

@ -19,21 +19,21 @@ private const val OUTGOING = false
private const val ACCOUNT_NUMBER = 1
private const val ACCOUNT_NAME = "TestAccount"
class AuthenticationErrorNotificationsTest : RobolectricTest() {
class AuthenticationErrorNotificationControllerTest : RobolectricTest() {
private val resourceProvider = TestNotificationResourceProvider()
private val notification = mock<Notification>()
private val notificationManager = mock<NotificationManagerCompat>()
private val builder = createFakeNotificationBuilder(notification)
private val notificationHelper = createFakeNotificationHelper(notificationManager, builder)
private val account = createFakeAccount()
private val authenticationErrorNotifications = TestAuthenticationErrorNotifications()
private val controller = TestAuthenticationErrorNotificationController()
private val contentIntent = mock<PendingIntent>()
@Test
fun showAuthenticationErrorNotification_withIncomingServer_shouldCreateNotification() {
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, INCOMING)
authenticationErrorNotifications.showAuthenticationErrorNotification(account, INCOMING)
controller.showAuthenticationErrorNotification(account, INCOMING)
verify(notificationManager).notify(notificationId, notification)
assertAuthenticationErrorNotificationContents()
@ -43,7 +43,7 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
fun clearAuthenticationErrorNotification_withIncomingServer_shouldCancelNotification() {
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, INCOMING)
authenticationErrorNotifications.clearAuthenticationErrorNotification(account, INCOMING)
controller.clearAuthenticationErrorNotification(account, INCOMING)
verify(notificationManager).cancel(notificationId)
}
@ -52,7 +52,7 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
fun showAuthenticationErrorNotification_withOutgoingServer_shouldCreateNotification() {
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, OUTGOING)
authenticationErrorNotifications.showAuthenticationErrorNotification(account, OUTGOING)
controller.showAuthenticationErrorNotification(account, OUTGOING)
verify(notificationManager).notify(notificationId, notification)
assertAuthenticationErrorNotificationContents()
@ -62,7 +62,7 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
fun clearAuthenticationErrorNotification_withOutgoingServer_shouldCancelNotification() {
val notificationId = NotificationIds.getAuthenticationErrorNotificationId(account, OUTGOING)
authenticationErrorNotifications.clearAuthenticationErrorNotification(account, OUTGOING)
controller.clearAuthenticationErrorNotification(account, OUTGOING)
verify(notificationManager).cancel(notificationId)
}
@ -100,8 +100,8 @@ class AuthenticationErrorNotificationsTest : RobolectricTest() {
}
}
internal inner class TestAuthenticationErrorNotifications :
AuthenticationErrorNotifications(notificationHelper, mock(), resourceProvider) {
internal inner class TestAuthenticationErrorNotificationController :
AuthenticationErrorNotificationController(notificationHelper, mock(), resourceProvider) {
override fun createContentIntent(account: Account, incoming: Boolean): PendingIntent {
return contentIntent

View file

@ -19,21 +19,21 @@ private const val OUTGOING = false
private const val ACCOUNT_NUMBER = 1
private const val ACCOUNT_NAME = "TestAccount"
class CertificateErrorNotificationsTest : RobolectricTest() {
class CertificateErrorNotificationControllerTest : RobolectricTest() {
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
private val notification = mock<Notification>()
private val notificationManager = mock<NotificationManagerCompat>()
private val builder = createFakeNotificationBuilder(notification)
private val notificationHelper = createFakeNotificationHelper(notificationManager, builder)
private val account = createFakeAccount()
private val certificateErrorNotifications = TestCertificateErrorNotifications()
private val controller = TestCertificateErrorNotificationController()
private val contentIntent = mock<PendingIntent>()
@Test
fun testShowCertificateErrorNotificationForIncomingServer() {
val notificationId = NotificationIds.getCertificateErrorNotificationId(account, INCOMING)
certificateErrorNotifications.showCertificateErrorNotification(account, INCOMING)
controller.showCertificateErrorNotification(account, INCOMING)
verify(notificationManager).notify(notificationId, notification)
assertCertificateErrorNotificationContents()
@ -43,7 +43,7 @@ class CertificateErrorNotificationsTest : RobolectricTest() {
fun testClearCertificateErrorNotificationsForIncomingServer() {
val notificationId = NotificationIds.getCertificateErrorNotificationId(account, INCOMING)
certificateErrorNotifications.clearCertificateErrorNotifications(account, INCOMING)
controller.clearCertificateErrorNotifications(account, INCOMING)
verify(notificationManager).cancel(notificationId)
}
@ -52,7 +52,7 @@ class CertificateErrorNotificationsTest : RobolectricTest() {
fun testShowCertificateErrorNotificationForOutgoingServer() {
val notificationId = NotificationIds.getCertificateErrorNotificationId(account, OUTGOING)
certificateErrorNotifications.showCertificateErrorNotification(account, OUTGOING)
controller.showCertificateErrorNotification(account, OUTGOING)
verify(notificationManager).notify(notificationId, notification)
assertCertificateErrorNotificationContents()
@ -62,7 +62,7 @@ class CertificateErrorNotificationsTest : RobolectricTest() {
fun testClearCertificateErrorNotificationsForOutgoingServer() {
val notificationId = NotificationIds.getCertificateErrorNotificationId(account, OUTGOING)
certificateErrorNotifications.clearCertificateErrorNotifications(account, OUTGOING)
controller.clearCertificateErrorNotifications(account, OUTGOING)
verify(notificationManager).cancel(notificationId)
}
@ -101,7 +101,7 @@ class CertificateErrorNotificationsTest : RobolectricTest() {
}
}
internal inner class TestCertificateErrorNotifications : CertificateErrorNotifications(
internal inner class TestCertificateErrorNotificationController : CertificateErrorNotificationController(
notificationHelper, mock(), resourceProvider
) {
override fun createContentIntent(account: Account, incoming: Boolean): PendingIntent {

View file

@ -19,12 +19,12 @@ import org.mockito.kotlin.stubbing
private const val ACCOUNT_NAME = "Hugo"
private const val NEW_MESSAGE_COUNT = 3
class LockScreenNotificationTest : RobolectricTest() {
class LockScreenNotificationCreatorTest : RobolectricTest() {
private val resourceProvider = TestNotificationResourceProvider()
private val builder = createFakeNotificationBuilder()
private val publicBuilder = createFakeNotificationBuilder()
private var notificationData = createFakeNotificationData()
private var lockScreenNotification = LockScreenNotification(
private var notificationCreator = LockScreenNotificationCreator(
notificationHelper = createFakeNotificationHelper(publicBuilder),
resourceProvider = resourceProvider
)
@ -33,7 +33,7 @@ class LockScreenNotificationTest : RobolectricTest() {
fun configureLockScreenNotification_NOTHING() {
K9.lockScreenNotificationVisibility = LockScreenNotificationVisibility.NOTHING
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
notificationCreator.configureLockScreenNotification(builder, notificationData)
verify(builder).setVisibility(NotificationCompat.VISIBILITY_SECRET)
}
@ -42,7 +42,7 @@ class LockScreenNotificationTest : RobolectricTest() {
fun configureLockScreenNotification_APP_NAME() {
K9.lockScreenNotificationVisibility = LockScreenNotificationVisibility.APP_NAME
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
notificationCreator.configureLockScreenNotification(builder, notificationData)
verify(builder).setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
}
@ -51,7 +51,7 @@ class LockScreenNotificationTest : RobolectricTest() {
fun configureLockScreenNotification_EVERYTHING() {
K9.lockScreenNotificationVisibility = LockScreenNotificationVisibility.EVERYTHING
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
notificationCreator.configureLockScreenNotification(builder, notificationData)
verify(builder).setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
}
@ -68,7 +68,7 @@ class LockScreenNotificationTest : RobolectricTest() {
on { holderForLatestNotification } doReturn holder
}
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
notificationCreator.configureLockScreenNotification(builder, notificationData)
verify(publicBuilder).setSmallIcon(resourceProvider.iconNewMail)
verify(publicBuilder).setNumber(1)
@ -88,7 +88,7 @@ class LockScreenNotificationTest : RobolectricTest() {
on { getContentForSummaryNotification() } doReturn listOf(content1, content2, content3)
}
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
notificationCreator.configureLockScreenNotification(builder, notificationData)
verify(publicBuilder).setSmallIcon(resourceProvider.iconNewMail)
verify(publicBuilder).setNumber(NEW_MESSAGE_COUNT)
@ -103,7 +103,7 @@ class LockScreenNotificationTest : RobolectricTest() {
fun configureLockScreenNotification_SENDERS_makeSureWeGetEnoughSenderNames() {
assertThat(
NotificationData.MAX_NUMBER_OF_MESSAGES_FOR_SUMMARY_NOTIFICATION >=
LockScreenNotification.MAX_NUMBER_OF_SENDERS_IN_LOCK_SCREEN_NOTIFICATION
LockScreenNotificationCreator.MAX_NUMBER_OF_SENDERS_IN_LOCK_SCREEN_NOTIFICATION
).isTrue()
}
@ -116,7 +116,7 @@ class LockScreenNotificationTest : RobolectricTest() {
val content5 = createNotificationContent("ed@example.com")
val content6 = createNotificationContent("fiona@example.com")
val result = lockScreenNotification.createCommaSeparatedListOfSenders(
val result = notificationCreator.createCommaSeparatedListOfSenders(
listOf(content1, content2, content3, content4, content5, content6)
)
@ -132,7 +132,7 @@ class LockScreenNotificationTest : RobolectricTest() {
on { newMessagesCount } doReturn NEW_MESSAGE_COUNT
}
lockScreenNotification.configureLockScreenNotification(builder, notificationData)
notificationCreator.configureLockScreenNotification(builder, notificationData)
verify(publicBuilder).setSmallIcon(resourceProvider.iconNewMail)
verify(publicBuilder).setNumber(NEW_MESSAGE_COUNT)

View file

@ -20,17 +20,17 @@ import org.mockito.kotlin.whenever
private const val ACCOUNT_NUMBER = 23
class NewMailNotificationsTest : K9RobolectricTest() {
class NewMailNotificationControllerTest : K9RobolectricTest() {
private val account = createAccount()
private val notificationManager = createNotificationManager()
private val contentCreator = createNotificationContentCreator()
private val messageSummaryNotifications = createMessageSummaryNotifications()
private val singleMessageNotifications = createSingleMessageNotifications()
private val newMailNotifications = TestNewMailNotifications(
private val summaryNotificationCreator = createSummaryNotificationCreator()
private val singleMessageNotificationCreator = createSingleMessageNotificationCreator()
private val controller = TestNewMailNotificationController(
notificationHelper = createNotificationHelper(notificationManager),
contentCreator = contentCreator,
messageSummaryNotifications = messageSummaryNotifications,
singleMessageNotifications = singleMessageNotifications
summaryNotificationCreator = summaryNotificationCreator,
singleMessageNotificationCreator = singleMessageNotificationCreator
)
@Test
@ -43,10 +43,10 @@ class NewMailNotificationsTest : K9RobolectricTest() {
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder))
val singleMessageNotification = createNotification()
val summaryNotification = createNotification()
addToSingleMessageNotifications(holder, singleMessageNotification)
addToSummaryNotifications(summaryNotification)
addToSingleMessageNotificationCreator(holder, singleMessageNotification)
addToSummaryNotificationCreator(summaryNotification)
newMailNotifications.addNewMailNotification(account, message, silent = false)
controller.addNewMailNotification(account, message, silent = false)
val singleMessageNotificationId = NotificationIds.getSingleMessageNotificationId(account, notificationIndex)
verify(notificationManager).notify(singleMessageNotificationId, singleMessageNotification)
@ -64,10 +64,10 @@ class NewMailNotificationsTest : K9RobolectricTest() {
whenAddingContentReturn(content, AddNotificationResult.replaceNotification(holder))
val singleMessageNotification = createNotification()
val summaryNotification = createNotification()
addToSingleMessageNotifications(holder, singleMessageNotification)
addToSummaryNotifications(summaryNotification)
addToSingleMessageNotificationCreator(holder, singleMessageNotification)
addToSummaryNotificationCreator(summaryNotification)
newMailNotifications.addNewMailNotification(account, message, silent = false)
controller.addNewMailNotification(account, message, silent = false)
val singleMessageNotificationId = NotificationIds.getSingleMessageNotificationId(account, notificationIndex)
verify(notificationManager).notify(singleMessageNotificationId, singleMessageNotification)
@ -93,12 +93,12 @@ class NewMailNotificationsTest : K9RobolectricTest() {
val singleMessageNotificationOne = createNotification()
val singleMessageNotificationTwo = createNotification()
val summaryNotification = createNotification()
addToSingleMessageNotifications(holderOne, singleMessageNotificationOne)
addToSingleMessageNotifications(holderTwo, singleMessageNotificationTwo)
addToSummaryNotifications(summaryNotification)
addToSingleMessageNotificationCreator(holderOne, singleMessageNotificationOne)
addToSingleMessageNotificationCreator(holderTwo, singleMessageNotificationTwo)
addToSummaryNotificationCreator(summaryNotification)
newMailNotifications.addNewMailNotification(account, messageOne, silent = false)
newMailNotifications.addNewMailNotification(account, messageTwo, silent = false)
controller.addNewMailNotification(account, messageOne, silent = false)
controller.addNewMailNotification(account, messageTwo, silent = false)
val singleMessageNotificationIdOne = NotificationIds.getSingleMessageNotificationId(account, notificationIndexOne)
verify(notificationManager).notify(singleMessageNotificationIdOne, singleMessageNotificationOne)
@ -112,7 +112,7 @@ class NewMailNotificationsTest : K9RobolectricTest() {
fun testRemoveNewMailNotificationWithoutNotificationData() {
val messageReference = createMessageReference(1)
newMailNotifications.removeNewMailNotification(account, messageReference)
controller.removeNewMailNotification(account, messageReference)
verify(notificationManager, never()).cancel(anyInt())
}
@ -127,11 +127,11 @@ class NewMailNotificationsTest : K9RobolectricTest() {
addToNotificationContentCreator(message, content)
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder))
val summaryNotification = createNotification()
addToSummaryNotifications(summaryNotification)
newMailNotifications.addNewMailNotification(account, message, silent = false)
addToSummaryNotificationCreator(summaryNotification)
controller.addNewMailNotification(account, message, silent = false)
whenRemovingContentReturn(messageReference, RemoveNotificationResult.unknownNotification())
newMailNotifications.removeNewMailNotification(account, messageReference)
controller.removeNewMailNotification(account, messageReference)
verify(notificationManager, never()).cancel(anyInt())
}
@ -147,11 +147,11 @@ class NewMailNotificationsTest : K9RobolectricTest() {
addToNotificationContentCreator(message, content)
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder))
val summaryNotification = createNotification()
addToSummaryNotifications(summaryNotification)
newMailNotifications.addNewMailNotification(account, message, silent = false)
addToSummaryNotificationCreator(summaryNotification)
controller.addNewMailNotification(account, message, silent = false)
whenRemovingContentReturn(messageReference, RemoveNotificationResult.cancelNotification(notificationId))
newMailNotifications.removeNewMailNotification(account, messageReference)
controller.removeNewMailNotification(account, messageReference)
verify(notificationManager).cancel(notificationId)
val summaryNotificationId = NotificationIds.getNewMailSummaryNotificationId(account)
@ -169,13 +169,13 @@ class NewMailNotificationsTest : K9RobolectricTest() {
addToNotificationContentCreator(message, content)
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder))
val summaryNotification = createNotification()
addToSummaryNotifications(summaryNotification)
newMailNotifications.addNewMailNotification(account, message, silent = false)
addToSummaryNotificationCreator(summaryNotification)
controller.addNewMailNotification(account, message, silent = false)
whenRemovingContentReturn(messageReference, RemoveNotificationResult.cancelNotification(notificationId))
whenever(newMailNotifications.notificationData.newMessagesCount).thenReturn(0)
whenever(controller.notificationData.newMessagesCount).thenReturn(0)
setActiveNotificationIds()
newMailNotifications.removeNewMailNotification(account, messageReference)
controller.removeNewMailNotification(account, messageReference)
verify(notificationManager).cancel(notificationId)
val summaryNotificationId = NotificationIds.getNewMailSummaryNotificationId(account)
@ -195,15 +195,15 @@ class NewMailNotificationsTest : K9RobolectricTest() {
addToNotificationContentCreator(message, contentOne)
whenAddingContentReturn(contentOne, AddNotificationResult.newNotification(holderOne))
val summaryNotification = createNotification()
addToSummaryNotifications(summaryNotification)
addToSummaryNotificationCreator(summaryNotification)
val singleMessageNotificationOne = createNotification()
val singleMessageNotificationTwo = createNotification()
addToSingleMessageNotifications(holderOne, singleMessageNotificationOne)
addToSingleMessageNotifications(holderTwo, singleMessageNotificationTwo)
newMailNotifications.addNewMailNotification(account, message, silent = false)
addToSingleMessageNotificationCreator(holderOne, singleMessageNotificationOne)
addToSingleMessageNotificationCreator(holderTwo, singleMessageNotificationTwo)
controller.addNewMailNotification(account, message, silent = false)
whenRemovingContentReturn(messageReference, RemoveNotificationResult.createNotification(holderTwo))
newMailNotifications.removeNewMailNotification(account, messageReference)
controller.removeNewMailNotification(account, messageReference)
verify(notificationManager).cancel(notificationId)
verify(notificationManager).notify(notificationId, singleMessageNotificationTwo)
@ -213,7 +213,7 @@ class NewMailNotificationsTest : K9RobolectricTest() {
@Test
fun testClearNewMailNotificationsWithoutNotificationData() {
newMailNotifications.clearNewMailNotifications(account)
controller.clearNewMailNotifications(account)
verify(notificationManager, never()).cancel(anyInt())
}
@ -228,9 +228,9 @@ class NewMailNotificationsTest : K9RobolectricTest() {
addToNotificationContentCreator(message, content)
setActiveNotificationIds(notificationId)
whenAddingContentReturn(content, AddNotificationResult.newNotification(holder))
newMailNotifications.addNewMailNotification(account, message, silent = false)
controller.addNewMailNotification(account, message, silent = false)
newMailNotifications.clearNewMailNotifications(account)
controller.clearNewMailNotifications(account)
verify(notificationManager).cancel(notificationId)
verify(notificationManager).cancel(NotificationIds.getNewMailSummaryNotificationId(account))
@ -270,35 +270,35 @@ class NewMailNotificationsTest : K9RobolectricTest() {
}
}
private fun createMessageSummaryNotifications(): MessageSummaryNotifications = mock()
private fun createSummaryNotificationCreator(): SummaryNotificationCreator = mock()
private fun addToSummaryNotifications(notificationToReturn: Notification) {
stubbing(messageSummaryNotifications) {
private fun addToSummaryNotificationCreator(notificationToReturn: Notification) {
stubbing(summaryNotificationCreator) {
on {
buildSummaryNotification(eq(account), eq(newMailNotifications.notificationData), anyBoolean())
buildSummaryNotification(eq(account), eq(controller.notificationData), anyBoolean())
} doReturn notificationToReturn
}
}
private fun createNotification(): Notification = mock()
private fun createSingleMessageNotifications(): SingleMessageNotifications = mock()
private fun createSingleMessageNotificationCreator(): SingleMessageNotificationCreator = mock()
private fun createMessageReference(number: Int): MessageReference {
return MessageReference("account", 1, number.toString())
}
private fun addToSingleMessageNotifications(
private fun addToSingleMessageNotificationCreator(
notificationHolder: NotificationHolder,
notificationToReturn: Notification
) {
stubbing(singleMessageNotifications) {
stubbing(singleMessageNotificationCreator) {
on { buildSingleMessageNotification(account, notificationHolder) } doReturn notificationToReturn
}
}
private fun whenAddingContentReturn(content: NotificationContent, result: AddNotificationResult) {
val notificationData = newMailNotifications.notificationData
val notificationData = controller.notificationData
val newCount = notificationData.newMessagesCount + 1
stubbing(notificationData) {
@ -308,24 +308,24 @@ class NewMailNotificationsTest : K9RobolectricTest() {
}
private fun whenRemovingContentReturn(messageReference: MessageReference, result: RemoveNotificationResult) {
stubbing(newMailNotifications.notificationData) {
stubbing(controller.notificationData) {
on { removeNotificationForMessage(messageReference) } doReturn result
}
}
private fun setActiveNotificationIds(vararg notificationIds: Int) {
stubbing(newMailNotifications.notificationData) {
stubbing(controller.notificationData) {
on { getActiveNotificationIds() } doReturn notificationIds
}
}
internal class TestNewMailNotifications(
internal class TestNewMailNotificationController(
notificationHelper: NotificationHelper,
contentCreator: NotificationContentCreator,
messageSummaryNotifications: MessageSummaryNotifications,
singleMessageNotifications: SingleMessageNotifications
) : NewMailNotifications(
notificationHelper, contentCreator, messageSummaryNotifications, singleMessageNotifications
summaryNotificationCreator: SummaryNotificationCreator,
singleMessageNotificationCreator: SingleMessageNotificationCreator
) : NewMailNotificationController(
notificationHelper, contentCreator, summaryNotificationCreator, singleMessageNotificationCreator
) {
val notificationData = mock<NotificationData>()

View file

@ -18,7 +18,7 @@ import org.mockito.kotlin.mock
private const val ACCOUNT_NUMBER = 1
private const val ACCOUNT_NAME = "TestAccount"
class SendFailedNotificationsTest : RobolectricTest() {
class SendFailedNotificationControllerTest : RobolectricTest() {
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
private val notification = mock<Notification>()
private val notificationManager = mock<NotificationManagerCompat>()
@ -26,7 +26,7 @@ class SendFailedNotificationsTest : RobolectricTest() {
private val account = createFakeAccount()
private val contentIntent = mock<PendingIntent>()
private val notificationId = NotificationIds.getSendFailedNotificationId(account)
private val sendFailedNotifications = SendFailedNotifications(
private val controller = SendFailedNotificationController(
notificationHelper = createFakeNotificationHelper(notificationManager, builder),
actionBuilder = createActionBuilder(contentIntent),
resourceProvider = resourceProvider
@ -36,7 +36,7 @@ class SendFailedNotificationsTest : RobolectricTest() {
fun testShowSendFailedNotification() {
val exception = Exception()
sendFailedNotifications.showSendFailedNotification(account, exception)
controller.showSendFailedNotification(account, exception)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconWarning)
@ -49,7 +49,7 @@ class SendFailedNotificationsTest : RobolectricTest() {
@Test
fun testClearSendFailedNotification() {
sendFailedNotifications.clearSendFailedNotification(account)
controller.clearSendFailedNotification(account)
verify(notificationManager).cancel(notificationId)
}

View file

@ -25,17 +25,17 @@ import org.mockito.kotlin.whenever
private const val ACCOUNT_NUMBER = 42
private const val ACCOUNT_NAME = "accountName"
class SingleMessageNotificationsTest : RobolectricTest() {
class SingleMessageNotificationCreatorTest : RobolectricTest() {
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
private val account = createAccount()
private val notification = mock<Notification>()
private val builder = createNotificationBuilder(notification)
private val actionCreator = mock<NotificationActionCreator>()
private val notifications = SingleMessageNotifications(
private val notificationCreator = SingleMessageNotificationCreator(
notificationHelper = createNotificationHelper(builder),
actionCreator = actionCreator,
resourceProvider = resourceProvider,
lockScreenNotification = mock()
lockScreenNotificationCreator = mock()
)
@Test
@ -58,7 +58,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
markAsReadPendingIntent
)
val result = notifications.buildSingleMessageNotification(account, holder)
val result = notificationCreator.buildSingleMessageNotification(account, holder)
assertThat(result).isEqualTo(notification)
verifyExtendWasOnlyCalledOnce()
@ -80,7 +80,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
deletePendingIntent
)
val result = notifications.buildSingleMessageNotification(account, holder)
val result = notificationCreator.buildSingleMessageNotification(account, holder)
assertThat(result).isEqualTo(notification)
verifyExtendWasOnlyCalledOnce()
@ -100,7 +100,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
archivePendingIntent
)
val result = notifications.buildSingleMessageNotification(account, holder)
val result = notificationCreator.buildSingleMessageNotification(account, holder)
assertThat(result).isEqualTo(notification)
verifyExtendWasOnlyCalledOnce()
@ -120,7 +120,7 @@ class SingleMessageNotificationsTest : RobolectricTest() {
markAsSpamPendingIntent
)
val result = notifications.buildSingleMessageNotification(account, holder)
val result = notificationCreator.buildSingleMessageNotification(account, holder)
assertThat(result).isEqualTo(notification)
verifyExtendWasOnlyCalledOnce()

View file

@ -33,7 +33,7 @@ private const val SUBJECT_2 = "subject2"
private const val SENDER_2 = "sender2"
private const val NOTIFICATION_ID = 23
class SummaryNotificationsTest : RobolectricTest() {
class SummaryNotificationCreatorTest : RobolectricTest() {
private val notification = mock<Notification>()
private val bigTextStyle = mockBuilder<NotificationCompat.BigTextStyle>()
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
@ -41,8 +41,8 @@ class SummaryNotificationsTest : RobolectricTest() {
private val notificationData = createFakeNotificationData(account)
private val builder = createFakeNotificationBuilder()
private val builder2 = createFakeNotificationBuilder()
private val lockScreenNotification = mock<LockScreenNotification>()
private val notifications = createSummaryNotifications(builder, lockScreenNotification)
private val lockScreenNotificationCreator = mock<LockScreenNotificationCreator>()
private val notificationCreator = createSummaryNotificationCreator(builder, lockScreenNotificationCreator)
@Test
fun buildSummaryNotification_withSingleMessageNotification() {
@ -51,7 +51,7 @@ class SummaryNotificationsTest : RobolectricTest() {
on { isSingleMessageNotification } doReturn true
}
val result = notifications.buildSummaryNotification(account, notificationData, false)
val result = notificationCreator.buildSummaryNotification(account, notificationData, false)
verify(builder).setSmallIcon(resourceProvider.iconNewMail)
verify(builder).color = ACCOUNT_COLOR
@ -64,7 +64,7 @@ class SummaryNotificationsTest : RobolectricTest() {
verify(builder).addAction(resourceProvider.iconReply, "Reply", null)
verify(builder).addAction(resourceProvider.iconMarkAsRead, "Mark Read", null)
verify(builder).addAction(resourceProvider.iconDelete, "Delete", null)
verify(lockScreenNotification).configureLockScreenNotification(builder, notificationData)
verify(lockScreenNotificationCreator).configureLockScreenNotification(builder, notificationData)
assertThat(result).isEqualTo(notification)
}
@ -76,7 +76,7 @@ class SummaryNotificationsTest : RobolectricTest() {
on { containsStarredMessages() } doReturn true
}
val result = notifications.buildSummaryNotification(account, notificationData, false)
val result = notificationCreator.buildSummaryNotification(account, notificationData, false)
verify(builder).setSmallIcon(resourceProvider.iconNewMail)
verify(builder).color = ACCOUNT_COLOR
@ -87,14 +87,14 @@ class SummaryNotificationsTest : RobolectricTest() {
verify(builder).setGroup("newMailNotifications-$ACCOUNT_NUMBER")
verify(builder).setGroupSummary(true)
verify(builder).priority = NotificationCompat.PRIORITY_HIGH
verify(builder).setStyle(notifications.inboxStyle)
verify(notifications.inboxStyle).setBigContentTitle("$NEW_MESSAGE_COUNT new messages")
verify(notifications.inboxStyle).setSummaryText(ACCOUNT_NAME)
verify(notifications.inboxStyle).addLine(SUMMARY)
verify(notifications.inboxStyle).addLine(SUMMARY_2)
verify(builder).setStyle(notificationCreator.inboxStyle)
verify(notificationCreator.inboxStyle).setBigContentTitle("$NEW_MESSAGE_COUNT new messages")
verify(notificationCreator.inboxStyle).setSummaryText(ACCOUNT_NAME)
verify(notificationCreator.inboxStyle).addLine(SUMMARY)
verify(notificationCreator.inboxStyle).addLine(SUMMARY_2)
verify(builder).addAction(resourceProvider.iconMarkAsRead, "Mark Read", null)
verify(builder).addAction(resourceProvider.iconDelete, "Delete", null)
verify(lockScreenNotification).configureLockScreenNotification(builder, notificationData)
verify(lockScreenNotificationCreator).configureLockScreenNotification(builder, notificationData)
assertThat(result).isEqualTo(notification)
}
@ -107,9 +107,9 @@ class SummaryNotificationsTest : RobolectricTest() {
on { getSummaryOverflowMessagesCount() } doReturn 23
}
notifications.buildSummaryNotification(account, notificationData, false)
notificationCreator.buildSummaryNotification(account, notificationData, false)
verify(notifications.inboxStyle).setSummaryText("+ 23 more on $ACCOUNT_NAME")
verify(notificationCreator.inboxStyle).setSummaryText("+ 23 more on $ACCOUNT_NAME")
}
@Test
@ -119,7 +119,7 @@ class SummaryNotificationsTest : RobolectricTest() {
on { isSingleMessageNotification } doReturn false
}
notifications.buildSummaryNotification(account, notificationData, false)
notificationCreator.buildSummaryNotification(account, notificationData, false)
verify(builder, never()).addAction(resourceProvider.iconDelete, "Delete", null)
}
@ -132,7 +132,7 @@ class SummaryNotificationsTest : RobolectricTest() {
on { isSingleMessageNotification } doReturn true
}
notifications.buildSummaryNotification(account, notificationData, false)
notificationCreator.buildSummaryNotification(account, notificationData, false)
verify(builder, never()).addAction(resourceProvider.iconDelete, "Delete", null)
}
@ -163,23 +163,23 @@ class SummaryNotificationsTest : RobolectricTest() {
}
}
private fun createSummaryNotifications(
private fun createSummaryNotificationCreator(
builder: NotificationCompat.Builder,
lockScreenNotification: LockScreenNotification
): TestMessageSummaryNotifications {
lockScreenNotificationCreator: LockScreenNotificationCreator
): TestSummaryNotificationCreator {
val notificationHelper = createFakeNotificationHelper(builder)
val singleMessageNotifications = TestSingleMessageNotifications(
val singleMessageNotificationCreator = TestSingleMessageNotificationCreator(
notificationHelper = notificationHelper,
actionCreator = mock(),
resourceProvider = resourceProvider,
lockScreenNotification = mock()
lockScreenNotificationCreator = mock()
)
return TestMessageSummaryNotifications(
return TestSummaryNotificationCreator(
notificationHelper = notificationHelper,
actionCreator = mock(),
lockScreenNotification = lockScreenNotification,
singleMessageNotifications = singleMessageNotifications,
lockScreenNotificationCreator = lockScreenNotificationCreator,
singleMessageNotificationCreator = singleMessageNotificationCreator,
resourceProvider = resourceProvider
)
}
@ -194,17 +194,17 @@ class SummaryNotificationsTest : RobolectricTest() {
}
}
internal class TestMessageSummaryNotifications(
internal class TestSummaryNotificationCreator(
notificationHelper: NotificationHelper,
actionCreator: NotificationActionCreator,
lockScreenNotification: LockScreenNotification,
singleMessageNotifications: SingleMessageNotifications,
lockScreenNotificationCreator: LockScreenNotificationCreator,
singleMessageNotificationCreator: SingleMessageNotificationCreator,
resourceProvider: NotificationResourceProvider
) : MessageSummaryNotifications(
) : SummaryNotificationCreator(
notificationHelper,
actionCreator,
lockScreenNotification,
singleMessageNotifications,
lockScreenNotificationCreator,
singleMessageNotificationCreator,
resourceProvider
) {
val inboxStyle = mockBuilder<NotificationCompat.InboxStyle>()
@ -214,16 +214,16 @@ class SummaryNotificationsTest : RobolectricTest() {
}
}
internal inner class TestSingleMessageNotifications(
internal inner class TestSingleMessageNotificationCreator(
notificationHelper: NotificationHelper,
actionCreator: NotificationActionCreator,
resourceProvider: NotificationResourceProvider,
lockScreenNotification: LockScreenNotification
) : SingleMessageNotifications(
lockScreenNotificationCreator: LockScreenNotificationCreator
) : SingleMessageNotificationCreator(
notificationHelper,
actionCreator,
resourceProvider,
lockScreenNotification
lockScreenNotificationCreator
) {
override fun createBigTextStyle(builder: NotificationCompat.Builder?): NotificationCompat.BigTextStyle {
return bigTextStyle

View file

@ -24,14 +24,14 @@ private const val ACCOUNT_NAME = "TestAccount"
private const val FOLDER_SERVER_ID = "INBOX"
private const val FOLDER_NAME = "Inbox"
class SyncNotificationsTest : RobolectricTest() {
class SyncNotificationControllerTest : RobolectricTest() {
private val resourceProvider: NotificationResourceProvider = TestNotificationResourceProvider()
private val notification = mock<Notification>()
private val notificationManager = mock<NotificationManagerCompat>()
private val builder = createFakeNotificationBuilder(notification)
private val account = createFakeAccount()
private val contentIntent = mock<PendingIntent>()
private val syncNotifications = SyncNotifications(
private val controller = SyncNotificationController(
notificationHelper = createFakeNotificationHelper(notificationManager, builder),
actionBuilder = createActionBuilder(contentIntent),
resourceProvider = resourceProvider
@ -41,7 +41,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testShowSendingNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.showSendingNotification(account)
controller.showSendingNotification(account)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconSendingMail)
@ -56,7 +56,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testClearSendingNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.clearSendingNotification(account)
controller.clearSendingNotification(account)
verify(notificationManager).cancel(notificationId)
}
@ -66,7 +66,7 @@ class SyncNotificationsTest : RobolectricTest() {
val localFolder = createFakeLocalFolder()
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.showFetchingMailNotification(account, localFolder)
controller.showFetchingMailNotification(account, localFolder)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconCheckingMail)
@ -81,7 +81,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testShowEmptyFetchingMailNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.showEmptyFetchingMailNotification(account)
controller.showEmptyFetchingMailNotification(account)
verify(notificationManager).notify(notificationId, notification)
verify(builder).setSmallIcon(resourceProvider.iconCheckingMail)
@ -94,7 +94,7 @@ class SyncNotificationsTest : RobolectricTest() {
fun testClearSendFailedNotification() {
val notificationId = getFetchingMailNotificationId(account)
syncNotifications.clearFetchingMailNotification(account)
controller.clearFetchingMailNotification(account)
verify(notificationManager).cancel(notificationId)
}