Skip to content

Commit eb6c016

Browse files
authored
Stop using AssertJ (square#8174)
* Stop using AssertJ This completes the migration to assertk. * Fix a missing import * Fix some type issues
1 parent 94c9c80 commit eb6c016

File tree

61 files changed

+388
-304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+388
-304
lines changed

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ androidx-junit = "androidx.test.ext:junit:1.1.5"
2121
androidx-test-runner = "androidx.test:runner:1.5.2"
2222
animalsniffer-annotations = "org.codehaus.mojo:animal-sniffer-annotations:1.23"
2323
aqute-resolve = { module = "biz.aQute.bnd:biz.aQute.resolve", version.ref = "biz-aQute-bnd" }
24-
assertj-core = "org.assertj:assertj-core:3.24.2"
2524
assertk = "com.willowtreeapps.assertk:assertk:0.27.0"
2625
bouncycastle-bcpkix = { module = "org.bouncycastle:bcpkix-jdk15to18", version.ref = "org-bouncycastle" }
2726
bouncycastle-bcprov = { module = "org.bouncycastle:bcprov-jdk15to18", version.ref = "org-bouncycastle" }

mockwebserver-deprecated/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies {
2121

2222
testImplementation(projects.okhttpTestingSupport)
2323
testImplementation(projects.okhttpTls)
24-
testImplementation(libs.assertj.core)
2524
}
2625

2726
mavenPublishing {

mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
*/
1616
package okhttp3.mockwebserver
1717

18+
import assertk.assertThat
19+
import assertk.assertions.contains
20+
import assertk.assertions.containsExactly
21+
import assertk.assertions.isBetween
22+
import assertk.assertions.isCloseTo
23+
import assertk.assertions.isEqualTo
24+
import assertk.assertions.isGreaterThan
25+
import assertk.assertions.isGreaterThanOrEqualTo
26+
import assertk.assertions.isNotEqualTo
27+
import assertk.assertions.isNotNull
28+
import assertk.assertions.isNull
29+
import assertk.assertions.isTrue
1830
import java.io.BufferedReader
1931
import java.io.Closeable
2032
import java.io.IOException
@@ -35,8 +47,6 @@ import okhttp3.TestUtil.assumeNotWindows
3547
import okhttp3.testing.PlatformRule
3648
import okhttp3.tls.HandshakeCertificates
3749
import okhttp3.tls.HeldCertificate
38-
import org.assertj.core.api.Assertions.assertThat
39-
import org.assertj.core.data.Offset
4050
import org.junit.jupiter.api.AfterEach
4151
import org.junit.jupiter.api.Assertions.fail
4252
import org.junit.jupiter.api.BeforeEach
@@ -354,7 +364,7 @@ class MockWebServerTest {
354364
i++
355365
}
356366
// Halfway +/- 0.5%
357-
assertThat(i.toFloat()).isCloseTo(512f, Offset.offset(5f))
367+
assertThat(i.toFloat()).isCloseTo(512f, 5f)
358368
}
359369

360370
@Test
@@ -494,7 +504,7 @@ class MockWebServerTest {
494504
refusedConnection.getResponseCode()
495505
fail<Any>("Second connection should be refused")
496506
} catch (e: ConnectException) {
497-
assertThat(e.message).contains("refused")
507+
assertThat(e.message!!).contains("refused")
498508
}
499509
}
500510

mockwebserver-junit4/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ dependencies {
1818
api(projects.mockwebserver3)
1919
api(libs.junit)
2020

21-
testImplementation(libs.assertj.core)
2221
testImplementation(libs.assertk)
2322
}
2423

mockwebserver-junit5/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ dependencies {
2626
compileOnly(libs.animalsniffer.annotations)
2727

2828
testRuntimeOnly(libs.junit.jupiter.engine)
29-
testImplementation(libs.assertj.core)
3029
testImplementation(libs.kotlin.junit5)
3130
testImplementation(projects.okhttpTestingSupport)
32-
testImplementation(libs.assertj.core)
3331
testImplementation(libs.assertk)
3432
}
3533

mockwebserver/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies {
2121
testImplementation(projects.okhttpTls)
2222
testRuntimeOnly(projects.mockwebserver3Junit5)
2323
testImplementation(libs.junit)
24-
testImplementation(libs.assertj.core)
2524
testImplementation(libs.assertk)
2625
}
2726

native-image-tests/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plugins {
66
}
77

88
dependencies {
9-
implementation(libs.assertj.core)
109
implementation(libs.junit.jupiter.api)
1110
implementation(libs.junit.jupiter.engine)
1211
implementation(libs.junit.platform.console)
@@ -19,7 +18,6 @@ dependencies {
1918
implementation(projects.okhttpSse)
2019
implementation(projects.okhttpTestingSupport)
2120
implementation(projects.okhttpTls)
22-
implementation(libs.assertj.core)
2321
implementation(projects.mockwebserver3)
2422
implementation(projects.mockwebserver)
2523
implementation(projects.okhttpJavaNetCookiejar)

native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
*/
1616
package okhttp3
1717

18+
import assertk.assertThat
19+
import assertk.assertions.isEqualTo
1820
import mockwebserver3.MockResponse
1921
import mockwebserver3.MockWebServer
2022
import okhttp3.HttpUrl.Companion.toHttpUrl
21-
import org.assertj.core.api.AssertionsForClassTypes.assertThat
2223
import org.junit.jupiter.api.Test
2324
import org.junit.jupiter.api.extension.RegisterExtension
2425
import org.junit.jupiter.params.ParameterizedTest

okhttp-android/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ dependencies {
5757

5858
testImplementation(libs.junit)
5959
testImplementation(libs.junit.ktx)
60-
testImplementation(libs.assertj.core)
6160
testImplementation(libs.assertk)
6261
testImplementation(projects.okhttpTls)
6362
testImplementation(libs.androidx.test.runner)
@@ -66,7 +65,6 @@ dependencies {
6665
testImplementation(libs.squareup.okio.fakefilesystem)
6766

6867
androidTestImplementation(projects.okhttpTls)
69-
androidTestImplementation(libs.assertj.core)
7068
androidTestImplementation(libs.assertk)
7169
androidTestImplementation(projects.mockwebserver3Junit4)
7270
androidTestImplementation(libs.androidx.test.runner)

okhttp-android/src/androidTest/kotlin/okhttp3/android/AndroidAsyncDnsTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import assertk.assertions.isEmpty
2626
import assertk.assertions.isEqualTo
2727
import assertk.assertions.isNotEmpty
2828
import assertk.assertions.isNull
29+
import assertk.fail
2930
import java.net.InetAddress
3031
import java.net.UnknownHostException
3132
import java.util.concurrent.CountDownLatch
@@ -38,7 +39,6 @@ import okhttp3.Request
3839
import okhttp3.tls.HandshakeCertificates
3940
import okhttp3.tls.HeldCertificate
4041
import okio.IOException
41-
import org.assertj.core.api.Assertions.fail
4242
import org.junit.Assume.assumeTrue
4343
import org.junit.AssumptionViolatedException
4444
import org.junit.Before

0 commit comments

Comments
 (0)