From 00b7bf45d7ec3388dca353eaa7de02f61666b173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf=20Montwe=CC=81?= Date: Tue, 14 Mar 2023 12:19:39 +0100 Subject: [PATCH] Change truth testing library to legacy and only allow usage in old modules --- .../autodiscovery/providersxml/ProvidersXmlDiscoveryTest.kt | 5 ++++- .../autodiscovery/thunderbird/ThunderbirdAutoconfigTest.kt | 4 +++- .../thunderbird/ThunderbirdAutoconfigUrlProviderTest.kt | 3 ++- app/core/build.gradle.kts | 1 + .../test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt | 3 ++- app/k9mail/build.gradle.kts | 2 ++ app/storage/build.gradle.kts | 1 + app/ui/legacy/build.gradle.kts | 1 + backend/imap/build.gradle.kts | 1 + gradle/libs.versions.toml | 4 +++- mail/common/build.gradle.kts | 1 + mail/protocols/imap/build.gradle.kts | 1 + mail/protocols/pop3/build.gradle.kts | 1 + mail/protocols/smtp/build.gradle.kts | 1 + 14 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/autodiscovery/providersxml/src/test/java/com/fsck/k9/autodiscovery/providersxml/ProvidersXmlDiscoveryTest.kt b/app/autodiscovery/providersxml/src/test/java/com/fsck/k9/autodiscovery/providersxml/ProvidersXmlDiscoveryTest.kt index a0fab7042..e810a53e8 100644 --- a/app/autodiscovery/providersxml/src/test/java/com/fsck/k9/autodiscovery/providersxml/ProvidersXmlDiscoveryTest.kt +++ b/app/autodiscovery/providersxml/src/test/java/com/fsck/k9/autodiscovery/providersxml/ProvidersXmlDiscoveryTest.kt @@ -1,12 +1,15 @@ package com.fsck.k9.autodiscovery.providersxml import androidx.test.core.app.ApplicationProvider +import assertk.assertThat +import assertk.assertions.isEqualTo +import assertk.assertions.isNotNull +import assertk.assertions.isNull import com.fsck.k9.RobolectricTest import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ConnectionSecurity import com.fsck.k9.oauth.OAuthConfiguration import com.fsck.k9.oauth.OAuthConfigurationProvider -import com.google.common.truth.Truth.assertThat import org.junit.Test class ProvidersXmlDiscoveryTest : RobolectricTest() { diff --git a/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigTest.kt b/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigTest.kt index 85cf04a52..92dbeaa37 100644 --- a/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigTest.kt +++ b/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigTest.kt @@ -1,10 +1,12 @@ package com.fsck.k9.autodiscovery.thunderbird +import assertk.assertThat +import assertk.assertions.isEqualTo +import assertk.assertions.isNotNull import com.fsck.k9.autodiscovery.api.DiscoveredServerSettings import com.fsck.k9.autodiscovery.api.DiscoveryResults import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.ConnectionSecurity -import com.google.common.truth.Truth.assertThat import org.junit.Test class ThunderbirdAutoconfigTest { diff --git a/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigUrlProviderTest.kt b/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigUrlProviderTest.kt index 30f88aee5..77864ec27 100644 --- a/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigUrlProviderTest.kt +++ b/app/autodiscovery/thunderbird/src/test/java/com/fsck/k9/autodiscovery/thunderbird/ThunderbirdAutoconfigUrlProviderTest.kt @@ -1,6 +1,7 @@ package com.fsck.k9.autodiscovery.thunderbird -import com.google.common.truth.Truth.assertThat +import assertk.assertThat +import assertk.assertions.containsExactly import org.junit.Test class ThunderbirdAutoconfigUrlProviderTest { diff --git a/app/core/build.gradle.kts b/app/core/build.gradle.kts index f14fba2c2..cace7bba6 100644 --- a/app/core/build.gradle.kts +++ b/app/core/build.gradle.kts @@ -35,6 +35,7 @@ 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) diff --git a/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt b/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt index 239812ce4..51f921213 100644 --- a/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt +++ b/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt @@ -1,6 +1,7 @@ package app.k9mail.html.cleaner -import com.google.common.truth.Truth.assertThat +import assertk.assertThat +import assertk.assertions.isEqualTo import org.jsoup.nodes.Document import org.junit.Test diff --git a/app/k9mail/build.gradle.kts b/app/k9mail/build.gradle.kts index cf8bec7f6..5c4ad3200 100644 --- a/app/k9mail/build.gradle.kts +++ b/app/k9mail/build.gradle.kts @@ -32,6 +32,8 @@ dependencies { debugImplementation(libs.leakcanary.android) } + testImplementation(libs.bundles.shared.jvm.test.legacy) + // Required for DependencyInjectionTest to be able to resolve OpenPgpApiManager testImplementation(projects.plugins.openpgpApiLib.openpgpApi) diff --git a/app/storage/build.gradle.kts b/app/storage/build.gradle.kts index 977e38388..798e0d896 100644 --- a/app/storage/build.gradle.kts +++ b/app/storage/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { implementation(libs.commons.io) implementation(libs.moshi) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.mail.testing) testImplementation(projects.app.testing) testImplementation(libs.robolectric) diff --git a/app/ui/legacy/build.gradle.kts b/app/ui/legacy/build.gradle.kts index 46f1efd94..e7370e536 100644 --- a/app/ui/legacy/build.gradle.kts +++ b/app/ui/legacy/build.gradle.kts @@ -55,6 +55,7 @@ dependencies { implementation(libs.glide) annotationProcessor(libs.glide.compiler) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.core.testing) testImplementation(projects.mail.testing) testImplementation(projects.app.storage) diff --git a/backend/imap/build.gradle.kts b/backend/imap/build.gradle.kts index 291562bda..69a7b98d3 100644 --- a/backend/imap/build.gradle.kts +++ b/backend/imap/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { implementation(libs.kotlinx.coroutines.core) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.mail.testing) testImplementation(projects.backend.testing) testImplementation(libs.mime4j.dom) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1b2264c15..e2e4a16e5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -145,10 +145,12 @@ shared-jvm-android = [ ] shared-jvm-test = [ "junit", - "truth", "assertk", "mockito-inline", "mockito-kotlin", "koin-test", "koin-test-junit4", ] +shared-jvm-test-legacy = [ + "truth", +] diff --git a/mail/common/build.gradle.kts b/mail/common/build.gradle.kts index 7373bfc16..369fd7cc7 100644 --- a/mail/common/build.gradle.kts +++ b/mail/common/build.gradle.kts @@ -21,6 +21,7 @@ dependencies { // We're only using this for its DefaultHostnameVerifier implementation(libs.apache.httpclient5) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.mail.testing) testImplementation(libs.icu4j.charset) } diff --git a/mail/protocols/imap/build.gradle.kts b/mail/protocols/imap/build.gradle.kts index 2f568e959..6b7bee73f 100644 --- a/mail/protocols/imap/build.gradle.kts +++ b/mail/protocols/imap/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { implementation(libs.commons.io) implementation(libs.okio) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.mail.testing) testImplementation(libs.okio) testImplementation(libs.mime4j.core) diff --git a/mail/protocols/pop3/build.gradle.kts b/mail/protocols/pop3/build.gradle.kts index 5662f180d..9005f4434 100644 --- a/mail/protocols/pop3/build.gradle.kts +++ b/mail/protocols/pop3/build.gradle.kts @@ -12,6 +12,7 @@ if (testCoverageEnabled) { dependencies { api(projects.mail.common) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.mail.testing) testImplementation(libs.okio) testImplementation(libs.jzlib) diff --git a/mail/protocols/smtp/build.gradle.kts b/mail/protocols/smtp/build.gradle.kts index a13958996..181b8edae 100644 --- a/mail/protocols/smtp/build.gradle.kts +++ b/mail/protocols/smtp/build.gradle.kts @@ -15,6 +15,7 @@ dependencies { implementation(libs.commons.io) implementation(libs.okio) + testImplementation(libs.bundles.shared.jvm.test.legacy) testImplementation(projects.mail.testing) testImplementation(libs.okio) testImplementation(libs.jzlib)