Change :app:core module to assertk

This commit is contained in:
Wolf Montwé 2023-03-20 10:33:30 +01:00
parent 032b1bcc16
commit d1f5b0222b
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
33 changed files with 154 additions and 74 deletions

View file

@ -35,7 +35,6 @@ dependencies {
testImplementation(projects.app.storage)
testImplementation(projects.app.testing)
testImplementation(libs.bundles.shared.jvm.test.legacy)
testImplementation(libs.kotlin.test)
testImplementation(libs.kotlin.reflect)
testImplementation(libs.robolectric)

View file

@ -1,11 +1,14 @@
package com.fsck.k9
import assertk.assertThat
import assertk.assertions.hasMessage
import assertk.assertions.isEqualTo
import assertk.assertions.isFailure
import assertk.assertions.isInstanceOf
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ConnectionSecurity
import com.fsck.k9.mail.ServerSettings
import com.fsck.k9.mail.store.imap.ImapStoreSettings
import com.google.common.truth.Truth.assertThat
import org.junit.Assert.fail
import org.junit.Test
class ServerSettingsSerializerTest {
@ -64,11 +67,10 @@ class ServerSettingsSerializerTest {
}
""".trimIndent()
try {
assertThat {
serverSettingsSerializer.deserialize(json)
fail("Expected exception")
} catch (e: IllegalArgumentException) {
assertThat(e).hasMessageThat().isEqualTo("'type' must not be missing")
}
}.isFailure()
.isInstanceOf(IllegalArgumentException::class)
.hasMessage("'type' must not be missing")
}
}

View file

@ -1,7 +1,12 @@
package com.fsck.k9.autocrypt
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isNotNull
import assertk.assertions.isNull
import assertk.assertions.isTrue
import com.fsck.k9.RobolectricTest
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class AutocryptDraftStateHeaderParserTest : RobolectricTest() {

View file

@ -1,6 +1,9 @@
package com.fsck.k9.controller
import com.google.common.truth.Truth.assertThat
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isNull
import assertk.assertions.isTrue
import kotlin.test.assertNotNull
import org.junit.Test

View file

@ -1,5 +1,7 @@
package com.fsck.k9.helper
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.Account
import com.fsck.k9.Identity
import com.fsck.k9.RobolectricTest
@ -8,7 +10,6 @@ import com.fsck.k9.mail.Message
import com.fsck.k9.mail.Message.RecipientType
import com.fsck.k9.mail.internet.AddressHeaderBuilder
import com.fsck.k9.mail.internet.MimeMessage
import com.google.common.truth.Truth.assertThat
import java.util.UUID
import org.junit.Test

View file

@ -1,9 +1,10 @@
package com.fsck.k9.helper
import androidx.core.net.toUri
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.RobolectricTest
import com.fsck.k9.mail.internet.MimeMessage
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertNull
import org.junit.Test

View file

@ -2,7 +2,8 @@ package com.fsck.k9.logging
import android.content.ContentResolver
import android.net.Uri
import com.google.common.truth.Truth.assertThat
import assertk.assertThat
import assertk.assertions.isEqualTo
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.FileNotFoundException

View file

@ -1,7 +1,13 @@
package com.fsck.k9.mailstore
import assertk.assertThat
import assertk.assertions.isFalse
import assertk.assertions.isNotNull
import assertk.assertions.isNotSameAs
import assertk.assertions.isNull
import assertk.assertions.isSameAs
import assertk.assertions.isTrue
import com.fsck.k9.mail.Flag
import com.google.common.truth.Truth.assertThat
import java.util.UUID
import org.junit.After
import org.junit.Before
@ -49,7 +55,7 @@ class MessageListCacheTest {
val cache2 = MessageListCache.getCache("u002")
assertThat(cache2).isNotSameInstanceAs(cache)
assertThat(cache2).isNotSameAs(cache)
}
@Test
@ -58,7 +64,7 @@ class MessageListCacheTest {
val cache2 = MessageListCache.getCache("u001")
assertThat(cache2).isSameInstanceAs(cache)
assertThat(cache2).isSameAs(cache)
}
@Test
@ -67,7 +73,7 @@ class MessageListCacheTest {
val result = cache.getFlagForMessage(1L, Flag.SEEN)
assertThat(result).isTrue()
assertThat(result).isNotNull().isTrue()
}
@Test
@ -93,7 +99,7 @@ class MessageListCacheTest {
val result = cache.getFlagForThread(1L, Flag.SEEN)
assertThat(result).isFalse()
assertThat(result).isNotNull().isFalse()
}
@Test

View file

@ -1,9 +1,11 @@
package com.fsck.k9.mailstore
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.isEqualTo
import com.fsck.k9.mail.Address
import com.fsck.k9.mail.Flag
import com.fsck.k9.message.extractors.PreviewResult
import com.google.common.truth.Truth.assertThat
import java.util.UUID
import org.junit.After
import org.junit.Before

View file

@ -1,9 +1,10 @@
package com.fsck.k9.mailstore
import assertk.assertThat
import assertk.assertions.isSameAs
import com.fsck.k9.Account
import com.fsck.k9.AccountRemovedListener
import com.fsck.k9.preferences.AccountManager
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.mockito.kotlin.KStubbing
import org.mockito.kotlin.argumentCaptor
@ -25,8 +26,8 @@ class MessageStoreManagerTest {
val accountManager = mock<AccountManager>()
val messageStoreManager = MessageStoreManager(accountManager, messageStoreFactory)
assertThat(messageStoreManager.getMessageStore(account)).isSameInstanceAs(messageStore1)
assertThat(messageStoreManager.getMessageStore(account)).isSameInstanceAs(messageStore1)
assertThat(messageStoreManager.getMessageStore(account)).isSameAs(messageStore1)
assertThat(messageStoreManager.getMessageStore(account)).isSameAs(messageStore1)
}
@Test
@ -37,11 +38,11 @@ class MessageStoreManagerTest {
}
val messageStoreManager = MessageStoreManager(accountManager, messageStoreFactory)
assertThat(messageStoreManager.getMessageStore(account)).isSameInstanceAs(messageStore1)
assertThat(messageStoreManager.getMessageStore(account)).isSameAs(messageStore1)
listenerCaptor.firstValue.onAccountRemoved(account)
assertThat(messageStoreManager.getMessageStore(account)).isSameInstanceAs(messageStore2)
assertThat(messageStoreManager.getMessageStore(account)).isSameAs(messageStore2)
}
private fun <T> KStubbing<T>.doNothingOn(block: T.() -> Any) {

View file

@ -1,11 +1,12 @@
package com.fsck.k9.message
import assertk.assertThat
import assertk.assertions.isGreaterThan
import com.fsck.k9.Account.QuoteStyle
import com.fsck.k9.Identity
import com.fsck.k9.RobolectricTest
import com.fsck.k9.mail.internet.MimeHeaderChecker
import com.fsck.k9.mail.internet.TextBody
import com.google.common.truth.Truth.assertThat
import org.junit.Test
private const val IDENTITY_HEADER = "X-K9mail-Identity"

View file

@ -1,8 +1,9 @@
package com.fsck.k9.message
import assertk.assertThat
import assertk.assertions.contains
import com.fsck.k9.RobolectricTest
import com.fsck.k9.helper.toCrLf
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class IdentityHeaderParserTest : RobolectricTest() {
@ -28,6 +29,6 @@ class IdentityHeaderParserTest : RobolectricTest() {
val result = IdentityHeaderParser.parse(input)
assertThat(result).containsEntry(IdentityField.SIGNATURE, "a".repeat(1000))
assertThat(result).contains(IdentityField.SIGNATURE, "a".repeat(1000))
}
}

View file

@ -1,10 +1,14 @@
package com.fsck.k9.message
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
import assertk.assertions.isNull
import com.fsck.k9.Account
import com.fsck.k9.Identity
import com.fsck.k9.helper.ReplyToParser
import com.fsck.k9.mail.buildMessage
import com.google.common.truth.Truth.assertThat
import org.junit.Test
private const val IDENTITY_EMAIL_ADDRESS = "myself@domain.example"

View file

@ -1,7 +1,8 @@
package com.fsck.k9.message
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.message.quote.InsertableHtmlContent
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

View file

@ -1,8 +1,10 @@
package com.fsck.k9.message.extractors
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isNull
import com.fsck.k9.mail.Part
import com.fsck.k9.mail.internet.MimeBodyPart
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class BasicPartInfoExtractorTest {

View file

@ -1,8 +1,9 @@
package com.fsck.k9.message.extractors
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.mail.internet.MimeBodyPart
import com.fsck.k9.message.MessageCreationHelper
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class PreviewTextExtractorTest {

View file

@ -1,10 +1,12 @@
package com.fsck.k9.message.extractors
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isNull
import com.fsck.k9.message.MessageCreationHelper.createEmptyPart
import com.fsck.k9.message.MessageCreationHelper.createMultipart
import com.fsck.k9.message.MessageCreationHelper.createPart
import com.fsck.k9.message.MessageCreationHelper.createTextPart
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class TextPartFinderTest {

View file

@ -1,6 +1,7 @@
package com.fsck.k9.message.html
import com.google.common.truth.Truth.assertThat
import assertk.assertThat
import assertk.assertions.isEqualTo
import org.junit.Test
class EmailSectionExtractorTest {

View file

@ -1,6 +1,8 @@
package com.fsck.k9.message.html
import com.google.common.truth.Truth.assertThat
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isSameAs
import org.junit.Test
class EmailSectionTest {
@ -45,7 +47,7 @@ class EmailSectionTest {
fun subSequence() {
val section = "[ One][ Two][ Three]".asEmailSection()
assertThat(section.subSequence(0, 11)).isSameInstanceAs(section)
assertThat(section.subSequence(0, 11)).isSameAs(section)
assertThat(section.subSequence(0, 3).asString()).isEqualTo("One")
assertThat(section.subSequence(0, 2).asString()).isEqualTo("On")
assertThat(section.subSequence(1, 3).asString()).isEqualTo("ne")

View file

@ -1,6 +1,7 @@
package com.fsck.k9.message.html
import com.google.common.truth.Truth.assertThat
import assertk.assertThat
import assertk.assertions.isEqualTo
import kotlin.test.assertNotNull
import org.junit.Test

View file

@ -1,8 +1,9 @@
package com.fsck.k9.message.html
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.mail.crlf
import com.fsck.k9.mail.removeLineBreaks
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class HtmlConverterTest {

View file

@ -96,10 +96,10 @@ class UriMatcherTest {
val uri = uris[i]
val startIndex = text.indexOf(uri)
assertThat(startIndex).isNotEqualTo(-1)
val (startIndex1, endIndex, uri1) = uriMatches[i]
assertThat(startIndex1).isEqualTo(startIndex)
assertThat(endIndex).isEqualTo(startIndex + uri.length)
assertThat(uri1).isEqualTo(uri)
val uriMatch = uriMatches[i]
assertThat(uriMatch.startIndex).isEqualTo(startIndex)
assertThat(uriMatch.endIndex).isEqualTo(startIndex + uri.length)
assertThat(uriMatch.uri).isEqualTo(uri)
i++
}
}

View file

@ -1,7 +1,8 @@
package com.fsck.k9.message.quote
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.K9
import com.google.common.truth.Truth.assertThat
import java.time.ZonedDateTime
import java.util.Date
import java.util.Locale

View file

@ -1,5 +1,7 @@
package com.fsck.k9.message.quote
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.Account.QuoteStyle
import com.fsck.k9.RobolectricTest
import com.fsck.k9.TestCoreResourceProvider
@ -7,7 +9,6 @@ import com.fsck.k9.mail.Address
import com.fsck.k9.mail.Message
import com.fsck.k9.mail.Message.RecipientType
import com.fsck.k9.mail.crlf
import com.google.common.truth.Truth.assertThat
import java.util.Date
import org.junit.Test
import org.mockito.kotlin.doReturn

View file

@ -1,9 +1,10 @@
package com.fsck.k9.message.signature
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.message.html.HtmlHelper.extractText
import com.fsck.k9.message.signature.HtmlSignatureRemover.Companion.stripSignature
import com.fsck.k9.testing.removeNewlines
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class HtmlSignatureRemoverTest {

View file

@ -1,5 +1,10 @@
package com.fsck.k9.notification
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotNull
import assertk.assertions.isSameAs
import com.fsck.k9.Account
import com.fsck.k9.Identity
import com.fsck.k9.K9
@ -7,7 +12,6 @@ import com.fsck.k9.K9.LockScreenNotificationVisibility
import com.fsck.k9.NotificationLight
import com.fsck.k9.NotificationVibration
import com.fsck.k9.VibratePattern
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.mockito.kotlin.mock
@ -21,7 +25,7 @@ class BaseNotificationDataCreatorTest {
val result = notificationDataCreator.createBaseNotificationData(notificationData)
assertThat(result.account).isSameInstanceAs(account)
assertThat(result.account).isSameAs(account)
}
@Test
@ -163,9 +167,8 @@ class BaseNotificationDataCreatorTest {
val result = notificationDataCreator.createBaseNotificationData(notificationData)
assertThat(result.appearance.vibrationPattern).isEqualTo(
NotificationVibration.getSystemPattern(VibratePattern.Pattern3, 2),
)
assertThat(result.appearance.vibrationPattern).isNotNull()
.isEqualTo(NotificationVibration.getSystemPattern(VibratePattern.Pattern3, 2))
}
@Test

View file

@ -1,6 +1,17 @@
package com.fsck.k9.notification
import app.k9mail.core.testing.TestClock
import assertk.assertThat
import assertk.assertions.containsExactlyInAnyOrder
import assertk.assertions.doesNotContain
import assertk.assertions.hasSize
import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotNull
import assertk.assertions.isNull
import assertk.assertions.isTrue
import com.fsck.k9.Account
import com.fsck.k9.controller.MessageReference
import com.fsck.k9.mailstore.LocalMessage
@ -8,7 +19,6 @@ import com.fsck.k9.mailstore.LocalStore
import com.fsck.k9.mailstore.LocalStoreProvider
import com.fsck.k9.mailstore.MessageStoreManager
import com.fsck.k9.mailstore.NotificationMessage
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertNotNull
import kotlinx.datetime.Instant
import org.junit.Test
@ -60,7 +70,7 @@ class NewMailNotificationManagerTest {
summary = "summary",
),
)
assertThat(result.summaryNotificationData).isInstanceOf(SummarySingleNotificationData::class.java)
assertThat(result.summaryNotificationData).isNotNull().isInstanceOf(SummarySingleNotificationData::class.java)
val summaryNotificationData = result.summaryNotificationData as SummarySingleNotificationData
assertThat(summaryNotificationData.singleNotificationData.isSilent).isFalse()
}
@ -98,7 +108,7 @@ class NewMailNotificationManagerTest {
),
)
assertThat(result.baseNotificationData.newMessagesCount).isEqualTo(2)
assertThat(result.summaryNotificationData).isInstanceOf(SummaryInboxNotificationData::class.java)
assertThat(result.summaryNotificationData).isNotNull().isInstanceOf(SummaryInboxNotificationData::class.java)
val summaryNotificationData = result.summaryNotificationData as SummaryInboxNotificationData
assertThat(summaryNotificationData.content).isEqualTo(listOf("Zoe Meeting", "Alice Hi Bob"))
assertThat(summaryNotificationData.messageReferences).isEqualTo(
@ -173,7 +183,7 @@ class NewMailNotificationManagerTest {
}
assertNotNull(result) { data ->
assertThat(data.cancelNotificationIds).containsExactly(
assertThat(data.cancelNotificationIds).containsExactlyInAnyOrder(
NotificationIds.getNewMailSummaryNotificationId(account),
NotificationIds.getSingleMessageNotificationId(account, 0),
)
@ -219,7 +229,7 @@ class NewMailNotificationManagerTest {
assertThat(data.cancelNotificationIds).isEqualTo(listOf(notificationIdTwo))
assertThat(data.singleNotificationData).isEmpty()
assertThat(data.baseNotificationData.newMessagesCount).isEqualTo(2)
assertThat(data.summaryNotificationData).isInstanceOf(SummaryInboxNotificationData::class.java)
assertThat(data.summaryNotificationData).isNotNull().isInstanceOf(SummaryInboxNotificationData::class.java)
val summaryNotificationData = data.summaryNotificationData as SummaryInboxNotificationData
assertThat(summaryNotificationData.content).isEqualTo(listOf("Alice Three", "Alice One"))
assertThat(summaryNotificationData.messageReferences).isEqualTo(
@ -307,7 +317,7 @@ class NewMailNotificationManagerTest {
),
)
assertThat(data.summaryNotificationData).isInstanceOf(SummarySingleNotificationData::class.java)
assertThat(data.summaryNotificationData).isNotNull().isInstanceOf(SummarySingleNotificationData::class.java)
val summaryNotificationData = data.summaryNotificationData as SummarySingleNotificationData
assertThat(summaryNotificationData.singleNotificationData.isSilent).isTrue()
assertThat(summaryNotificationData.singleNotificationData.content).isEqualTo(
@ -344,7 +354,7 @@ class NewMailNotificationManagerTest {
assertThat(data.singleNotificationData).hasSize(MAX_NUMBER_OF_NEW_MESSAGE_NOTIFICATIONS)
assertThat(data.singleNotificationData.map { it.content.sender }).doesNotContain("inactive")
assertThat(data.summaryNotificationData).isInstanceOf(SummaryInboxNotificationData::class.java)
assertThat(data.summaryNotificationData).isNotNull().isInstanceOf(SummaryInboxNotificationData::class.java)
val summaryNotificationData = data.summaryNotificationData as SummaryInboxNotificationData
assertThat(summaryNotificationData.isSilent).isTrue()
}

View file

@ -1,6 +1,8 @@
package com.fsck.k9.notification
import app.k9mail.core.android.common.contact.ContactRepository
import assertk.assertThat
import assertk.assertions.isEqualTo
import com.fsck.k9.Account
import com.fsck.k9.RobolectricTest
import com.fsck.k9.controller.MessageReference
@ -8,7 +10,6 @@ import com.fsck.k9.mail.Address
import com.fsck.k9.mail.Message.RecipientType
import com.fsck.k9.mailstore.LocalMessage
import com.fsck.k9.message.extractors.PreviewResult.PreviewType
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.mockito.kotlin.any
import org.mockito.kotlin.doReturn

View file

@ -1,9 +1,19 @@
package com.fsck.k9.notification
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.hasSize
import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotNull
import assertk.assertions.isNull
import assertk.assertions.isSameAs
import assertk.assertions.isTrue
import com.fsck.k9.Account
import com.fsck.k9.RobolectricTest
import com.fsck.k9.controller.MessageReference
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertNotNull
import org.junit.Test
@ -177,12 +187,12 @@ class NotificationDataStoreTest : RobolectricTest() {
assertNotNull(resultOne)
assertNotNull(resultTwo)
assertThat(resultTwo.notificationData.activeNotifications).hasSize(1)
assertThat(resultTwo.notificationData.activeNotifications.first().content).isSameInstanceAs(content2)
assertThat(resultTwo.notificationData.activeNotifications.first().content).isSameAs(content2)
assertThat(resultTwo.notificationStoreOperations).isEmpty()
with(resultTwo.notificationHolder) {
assertThat(notificationId).isEqualTo(resultOne.notificationHolder.notificationId)
assertThat(timestamp).isEqualTo(resultOne.notificationHolder.timestamp)
assertThat(content).isSameInstanceAs(content2)
assertThat(content).isSameAs(content2)
}
assertThat(resultTwo.shouldCancelNotification).isFalse()
}
@ -213,7 +223,7 @@ class NotificationDataStoreTest : RobolectricTest() {
val notificationHolder = resultTwo.notificationData.activeNotifications.first { notificationHolder ->
notificationHolder.content.messageReference == content.messageReference
}
assertThat(notificationHolder.content).isSameInstanceAs(content)
assertThat(notificationHolder.content).isSameAs(content)
}
private fun createAccount(): Account {

View file

@ -1,8 +1,12 @@
package com.fsck.k9.notification
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.containsNoDuplicates
import assertk.assertions.doesNotContain
import assertk.assertions.isEmpty
import assertk.assertions.isEqualTo
import com.fsck.k9.Account
import com.google.common.truth.Truth.assertThat
import com.google.common.truth.Truth.assertWithMessage
import org.junit.Test
class NotificationIdsTest {
@ -37,7 +41,7 @@ class NotificationIdsTest {
val notificationIds1 = getAccountNotificationIds(account1)
val notificationIds2 = getAccountNotificationIds(account2)
assertWithMessage("Reused notification IDs").that(notificationIds1 intersect notificationIds2).isEmpty()
assertThat(actual = notificationIds1 intersect notificationIds2, name = "Reused notification IDs").isEmpty()
}
@Test
@ -64,7 +68,7 @@ class NotificationIdsTest {
val minNotificationId = requireNotNull(notificationIds.minOrNull())
val maxNotificationId = requireNotNull(notificationIds.maxOrNull())
val notificationIdRange = (minNotificationId..maxNotificationId)
assertWithMessage("Skipped notification IDs").that(notificationIdRange - notificationIds).isEmpty()
assertThat(actual = notificationIdRange - notificationIds, name = "Skipped notification IDs").isEmpty()
}
@Test
@ -87,9 +91,8 @@ class NotificationIdsTest {
val notificationIds = NotificationIds.getAllMessageNotificationIds(account)
assertThat(notificationIds).containsExactlyElementsIn(
getNewMessageNotificationIds(account) + NotificationIds.getNewMailSummaryNotificationId(account),
)
val expected = getNewMessageNotificationIds(account) + NotificationIds.getNewMailSummaryNotificationId(account)
assertThat(notificationIds).containsExactly(*expected)
}
private fun getGeneralNotificationIds(): List<Int> {
@ -108,13 +111,13 @@ class NotificationIdsTest {
) + getNewMessageNotificationIds(account)
}
private fun getNewMessageNotificationIds(account: Account): List<Int> {
private fun getNewMessageNotificationIds(account: Account): Array<Int> {
return (0 until MAX_NUMBER_OF_NEW_MESSAGE_NOTIFICATIONS).map { index ->
NotificationIds.getSingleMessageNotificationId(account, index)
}
}.toTypedArray()
}
fun createAccount(accountNumber: Int): Account {
private fun createAccount(accountNumber: Int): Account {
return Account("uuid").apply {
this.accountNumber = accountNumber
}

View file

@ -1,10 +1,15 @@
package com.fsck.k9.notification
import assertk.assertThat
import assertk.assertions.contains
import assertk.assertions.doesNotContain
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import com.fsck.k9.Account
import com.fsck.k9.K9
import com.fsck.k9.K9.NotificationQuickDelete
import com.fsck.k9.controller.MessageReference
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class SingleMessageNotificationDataCreatorTest {

View file

@ -1,10 +1,16 @@
package com.fsck.k9.notification
import app.k9mail.core.testing.TestClock
import assertk.assertThat
import assertk.assertions.contains
import assertk.assertions.doesNotContain
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isInstanceOf
import assertk.assertions.isTrue
import com.fsck.k9.Account
import com.fsck.k9.K9
import com.fsck.k9.controller.MessageReference
import com.google.common.truth.Truth.assertThat
import kotlinx.datetime.Clock
import org.junit.After
import org.junit.Before

View file

@ -1,6 +1,7 @@
package com.fsck.k9.sasl
import com.google.common.truth.Truth.assertThat
import assertk.assertThat
import assertk.assertions.isEqualTo
import okio.ByteString.Companion.decodeBase64
import org.junit.Test