Use assertk's hasMessage()

This commit is contained in:
cketti 2023-10-25 16:32:53 +02:00
parent 4d14362541
commit c84b918436
3 changed files with 8 additions and 13 deletions

View file

@ -7,9 +7,9 @@ import app.k9mail.feature.account.common.domain.entity.AuthorizationState
import app.k9mail.feature.account.common.domain.entity.MailConnectionSecurity
import assertk.assertFailure
import assertk.assertThat
import assertk.assertions.hasMessage
import assertk.assertions.isEqualTo
import assertk.assertions.isInstanceOf
import assertk.assertions.prop
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ServerSettings
import kotlinx.coroutines.test.runTest
@ -39,8 +39,7 @@ class GetAccountStateTest {
assertFailure {
testSubject.execute(ACCOUNT_UUID)
}.isInstanceOf<IllegalStateException>()
.prop(IllegalStateException::message)
.isEqualTo("Account state for $ACCOUNT_UUID not found")
.hasMessage("Account state for $ACCOUNT_UUID not found")
}
private companion object {

View file

@ -7,9 +7,9 @@ import app.k9mail.feature.account.common.domain.entity.AuthorizationState
import app.k9mail.feature.account.common.domain.entity.MailConnectionSecurity
import assertk.assertFailure
import assertk.assertThat
import assertk.assertions.hasMessage
import assertk.assertions.isEqualTo
import assertk.assertions.isInstanceOf
import assertk.assertions.prop
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ServerSettings
import kotlinx.coroutines.test.runTest
@ -43,8 +43,7 @@ class LoadAccountStateTest {
assertFailure {
testSubject.execute(ACCOUNT_UUID)
}.isInstanceOf<IllegalStateException>()
.prop(IllegalStateException::message)
.isEqualTo("Account state for $ACCOUNT_UUID not found")
.hasMessage("Account state for $ACCOUNT_UUID not found")
}
private companion object {

View file

@ -8,9 +8,9 @@ import app.k9mail.feature.account.edit.AccountEditExternalContract.AccountUpdate
import app.k9mail.feature.account.edit.AccountEditExternalContract.AccountUpdaterResult
import assertk.assertFailure
import assertk.assertThat
import assertk.assertions.hasMessage
import assertk.assertions.isEqualTo
import assertk.assertions.isInstanceOf
import assertk.assertions.prop
import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.ServerSettings
import kotlinx.coroutines.test.runTest
@ -53,8 +53,7 @@ class SaveServerSettingsTest {
assertFailure {
testSubject.execute(ACCOUNT_UUID, isIncoming = true)
}.isInstanceOf<IllegalStateException>()
.prop(IllegalStateException::message)
.isEqualTo("Server settings not found")
.hasMessage("Server settings not found")
}
@Test
@ -92,8 +91,7 @@ class SaveServerSettingsTest {
assertFailure {
testSubject.execute(ACCOUNT_UUID, isIncoming = false)
}.isInstanceOf<IllegalStateException>()
.prop(IllegalStateException::message)
.isEqualTo("Server settings not found")
.hasMessage("Server settings not found")
}
@Test
@ -110,8 +108,7 @@ class SaveServerSettingsTest {
assertFailure {
testSubject.execute(ACCOUNT_UUID, isIncoming = true)
}.isInstanceOf<IllegalStateException>()
.prop(IllegalStateException::message)
.isEqualTo("Server settings update failed")
.hasMessage("Server settings update failed")
}
private companion object {