Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions android-ech/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
// AGP 9 brings Kotlin support with it — applying the Kotlin Android plugin here fails.
alias(libs.plugins.android.library)
alias(libs.plugins.android.junit5)
}

// The version of OkHttp under test. This suite defaults to the snapshot rather than to the
Expand Down Expand Up @@ -36,22 +35,11 @@ android {
// An AndroidJUnitRunner that calls OkHttp.initialize first. See EchTestRunner for why the
// library's own androidx Startup initializer doesn't cover an instrumentation APK.
testInstrumentationRunner = "okhttp.testbed.android.ech.EchTestRunner"
testInstrumentationRunnerArguments +=
mapOf(
// The suite is JUnit 5, as the JVM suites are.
"runnerBuilder" to "de.mannodermaus.junit5.AndroidJUnit5Builder",
)
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)

// JUnit 5 is compiled against Java 8 APIs — `java.util.function`, `Optional`, `java.time` —
// which Android only has from API 26. The suite runs on API 21 upwards, so without this the
// runner dies with NoClassDefFoundError on the oldest emulators in the matrix before a single
// test is reached. Desugaring is what makes "minSdk 21" true of the tests as well as the code.
isCoreLibraryDesugaringEnabled = true
}

testOptions {
Expand All @@ -60,8 +48,6 @@ android {
}

dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)

androidTestImplementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
androidTestImplementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")

Expand All @@ -72,10 +58,8 @@ dependencies {
androidTestImplementation("com.squareup.okhttp3:okhttp-android:$okhttpVersion")

androidTestImplementation(libs.assertk)
androidTestImplementation(libs.junit.jupiter.api)
androidTestImplementation(libs.junit5android.core)
androidTestImplementation(libs.junit4)
androidTestImplementation(libs.androidx.test.runner)
androidTestRuntimeOnly(libs.junit5android.runner)
}

// `check` doesn't run instrumentation tests, so the public-API check has to be wired to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import okhttp3.Request
import okhttp3.Response
import okhttp3.Route
import okhttp3.dnsoverhttps.DnsOverHttps
import org.junit.jupiter.api.Assumptions.assumeTrue
import org.junit.jupiter.api.Test
import org.junit.Assume.assumeTrue
import org.junit.Test

/**
* Encrypted Client Hello, end to end, against the containers `run-ech-test.sh` starts on the
Expand Down Expand Up @@ -117,10 +117,10 @@ class EncryptedClientHelloTest {

private fun fixture(): Fixture {
val arguments = InstrumentationRegistry.getArguments()
assumeTrue(arguments.getString("ech") == "true", "requires the host-side ECH fixtures")
assumeTrue("requires the host-side ECH fixtures", arguments.getString("ech") == "true")
assumeTrue(
Build.VERSION.SDK_INT >= TLS_13_API_LEVEL,
"the ECH fixture origin is TLS 1.3 only, which Android has from API $TLS_13_API_LEVEL",
Build.VERSION.SDK_INT >= TLS_13_API_LEVEL,
)
val dohPort = requireNotNull(arguments.getString("dohPort")).toInt()
val caCertificate = Base64.decode(requireNotNull(arguments.getString("caCertificate")), Base64.DEFAULT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import okhttp3.Request
import okhttp3.Response
import okhttp3.Route
import okhttp3.dnsoverhttps.DnsOverHttps
import org.junit.jupiter.api.Assumptions.assumeTrue
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.Test

/**
* [okhttp.testbed.network.EchTest]'s cases, on the one platform where they can all pass.
Expand All @@ -56,9 +56,9 @@ import org.junit.jupiter.api.Test
class PublicEncryptedClientHelloTest {
private lateinit var client: OkHttpClient

@BeforeEach
@Before
fun setUp() {
assumeTrue(Build.VERSION.SDK_INT >= 37, "ECH requires Android API 37")
assumeTrue("ECH requires Android API 37", Build.VERSION.SDK_INT >= 37)

val bootstrapClient = OkHttpClient()

Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.junit5) apply false
}

// The JDK the suites *run* on: what a user's application would be running when it calls the
Expand Down
9 changes: 2 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
[versions]
agp = "9.3.1"
android-junit5 = "2.0.1"
androidx-test-runner = "1.7.0"
assertk = "0.28.1"
# Backports the Java 8 APIs JUnit 5 needs onto the API 21 emulators in the android-ech matrix.
desugar-jdk-libs = "2.1.5"
junit4 = "4.13.2"
junit-platform = "1.14.4"
kotlin = "2.4.10"
# Must match the mockserver/mockserver image tag; the client refuses to talk to a
Expand All @@ -28,20 +26,17 @@ testcontainers = "2.0.5"
[libraries]
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
assertk = { module = "com.willowtreeapps.assertk:assertk", version.ref = "assertk" }
desugar-jdk-libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar-jdk-libs" }
junit4 = { module = "junit:junit", version.ref = "junit4" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "org-junit-jupiter" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "org-junit-jupiter" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "org-junit-jupiter" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }
junit5android-core = { module = "de.mannodermaus.junit5:android-test-core", version.ref = "android-junit5" }
junit5android-runner = { module = "de.mannodermaus.junit5:android-test-runner", version.ref = "android-junit5" }
mockserver = { module = "org.testcontainers:testcontainers-mockserver", version.ref = "testcontainers" }
mockserver-client = { module = "org.mock-server:mockserver-client-java-no-dependencies", version.ref = "mockserver" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
testcontainers-junit5 = { module = "org.testcontainers:testcontainers-junit-jupiter", version.ref = "testcontainers" }

[plugins]
android-junit5 = { id = "de.mannodermaus.android-junit5", version.ref = "android-junit5" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"packageRules": [
{
"description": "Stay on JUnit 5. JUnit 6 requires Java 17+ and a coordinated bump of the android-junit5 plugin, so it is not a drop-in upgrade here.",
"description": "Keep the JVM test suites on JUnit 5. JUnit 6 requires Java 17+, so it is not a drop-in upgrade here.",
"matchManagers": [
"gradle"
],
Expand Down