From 71a4991501d9d98d1e2a7ef3ccec3380909cd659 Mon Sep 17 00:00:00 2001 From: Jonatan Ivanov Date: Tue, 23 Apr 2024 16:10:37 -0700 Subject: [PATCH] Use Mockito 4 in observation-test, micrometer-test Mockito 5 is not compatible with Java 8. Closes gh-4968 See gh-4963 --- dependencies.gradle | 1 - gradle/libs.versions.toml | 6 ++++-- implementations/micrometer-registry-appoptics/build.gradle | 1 + implementations/micrometer-registry-cloudwatch/build.gradle | 1 + .../micrometer-registry-cloudwatch2/build.gradle | 1 + implementations/micrometer-registry-datadog/build.gradle | 1 + implementations/micrometer-registry-dynatrace/build.gradle | 1 + implementations/micrometer-registry-new-relic/build.gradle | 1 + implementations/micrometer-registry-wavefront/build.gradle | 1 + micrometer-core/build.gradle | 2 +- micrometer-observation-test/build.gradle | 2 +- micrometer-observation/build.gradle | 2 +- micrometer-test/build.gradle | 2 +- samples/micrometer-samples-hazelcast3/build.gradle | 1 + 14 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 3d706d643b..95f04155e0 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -68,7 +68,6 @@ def VERSIONS = [ libs.junitJupiter, libs.junitPlatformLauncher, libs.latencyUtils, - libs.mockitoCore, libs.mongoSync, libs.postgre, libs.slf4jApi, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fbea24c699..00add1e05d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -55,7 +55,8 @@ latency-utils = "2.0.3" logback12 = "1.2.13" log4j = "2.20.0" maven-resolver = "1.9.18" -mockito = "5.5.0" +mockito4 = "4.11.0" +mockito5 = "5.5.0" mongo = "4.9.1" netty = "4.1.108.Final" newrelic-api = "5.14.0" @@ -160,7 +161,8 @@ log4j = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" mavenResolverConnectorBasic = { module = "org.apache.maven.resolver:maven-resolver-connector-basic", version.ref = "maven-resolver" } mavenResolverTransportHttp = { module = "org.apache.maven.resolver:maven-resolver-transport-http", version.ref = "maven-resolver" } mavenResolverProvider = { module = "org.apache.maven:maven-resolver-provider", version = "3.9.6" } -mockitoCore = { module = "org.mockito:mockito-core", version.ref = "mockito" } +mockitoCore4 = { module = "org.mockito:mockito-core", version.ref = "mockito4" } +mockitoCore5 = { module = "org.mockito:mockito-core", version.ref = "mockito5" } mongoSync = { module = "org.mongodb:mongodb-driver-sync", version.ref = "mongo" } nettyBom = { module = "io.netty:netty-bom", version.ref = "netty" } newrelicApi = { module = "com.newrelic.agent.java:newrelic-api", version.ref = "newrelic-api" } diff --git a/implementations/micrometer-registry-appoptics/build.gradle b/implementations/micrometer-registry-appoptics/build.gradle index 7ad798c7c0..f194946ba4 100644 --- a/implementations/micrometer-registry-appoptics/build.gradle +++ b/implementations/micrometer-registry-appoptics/build.gradle @@ -4,4 +4,5 @@ dependencies { implementation 'org.slf4j:slf4j-api' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 } diff --git a/implementations/micrometer-registry-cloudwatch/build.gradle b/implementations/micrometer-registry-cloudwatch/build.gradle index f3d65834c1..ac90ba3f8a 100644 --- a/implementations/micrometer-registry-cloudwatch/build.gradle +++ b/implementations/micrometer-registry-cloudwatch/build.gradle @@ -7,4 +7,5 @@ dependencies { implementation 'org.slf4j:slf4j-api' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 } diff --git a/implementations/micrometer-registry-cloudwatch2/build.gradle b/implementations/micrometer-registry-cloudwatch2/build.gradle index 4c5cbfaa16..5a120b9dd1 100644 --- a/implementations/micrometer-registry-cloudwatch2/build.gradle +++ b/implementations/micrometer-registry-cloudwatch2/build.gradle @@ -7,4 +7,5 @@ dependencies { implementation 'org.slf4j:slf4j-api' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 } diff --git a/implementations/micrometer-registry-datadog/build.gradle b/implementations/micrometer-registry-datadog/build.gradle index 7ad798c7c0..f194946ba4 100644 --- a/implementations/micrometer-registry-datadog/build.gradle +++ b/implementations/micrometer-registry-datadog/build.gradle @@ -4,4 +4,5 @@ dependencies { implementation 'org.slf4j:slf4j-api' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 } diff --git a/implementations/micrometer-registry-dynatrace/build.gradle b/implementations/micrometer-registry-dynatrace/build.gradle index a9862ed175..2322e5d24c 100644 --- a/implementations/micrometer-registry-dynatrace/build.gradle +++ b/implementations/micrometer-registry-dynatrace/build.gradle @@ -6,6 +6,7 @@ dependencies { implementation 'com.dynatrace.metric.util:dynatrace-metric-utils-java' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 testImplementation 'com.fasterxml.jackson.core:jackson-databind' testImplementation 'org.awaitility:awaitility' } diff --git a/implementations/micrometer-registry-new-relic/build.gradle b/implementations/micrometer-registry-new-relic/build.gradle index f67d5ca188..ea32b36bf2 100644 --- a/implementations/micrometer-registry-new-relic/build.gradle +++ b/implementations/micrometer-registry-new-relic/build.gradle @@ -5,6 +5,7 @@ dependencies { optionalApi 'com.newrelic.agent.java:newrelic-api' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 } jar { diff --git a/implementations/micrometer-registry-wavefront/build.gradle b/implementations/micrometer-registry-wavefront/build.gradle index a090cf7d7e..74b24107ca 100644 --- a/implementations/micrometer-registry-wavefront/build.gradle +++ b/implementations/micrometer-registry-wavefront/build.gradle @@ -5,4 +5,5 @@ dependencies { implementation 'org.slf4j:slf4j-api' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 } diff --git a/micrometer-core/build.gradle b/micrometer-core/build.gradle index cebd756788..58a4fa1cf9 100644 --- a/micrometer-core/build.gradle +++ b/micrometer-core/build.gradle @@ -154,7 +154,7 @@ dependencies { // Needed for LogbackMetrics tests testImplementation libs.slf4jApi - testImplementation 'org.mockito:mockito-core' + testImplementation libs.mockitoCore5 testImplementation 'org.hsqldb:hsqldb' testImplementation 'com.h2database:h2' diff --git a/micrometer-observation-test/build.gradle b/micrometer-observation-test/build.gradle index 9e4d3b0df3..5f553df1dd 100644 --- a/micrometer-observation-test/build.gradle +++ b/micrometer-observation-test/build.gradle @@ -6,7 +6,7 @@ dependencies { api 'org.assertj:assertj-core' api 'org.junit.jupiter:junit-jupiter' - implementation 'org.mockito:mockito-core' + implementation libs.mockitoCore4 testImplementation 'org.awaitility:awaitility' } diff --git a/micrometer-observation/build.gradle b/micrometer-observation/build.gradle index a883b76736..972a124084 100644 --- a/micrometer-observation/build.gradle +++ b/micrometer-observation/build.gradle @@ -38,7 +38,7 @@ dependencies { exclude group: "org.slf4j", module: "slf4j-api" } - testImplementation 'org.mockito:mockito-core' + testImplementation libs.mockitoCore5 testImplementation 'org.assertj:assertj-core' testImplementation 'org.awaitility:awaitility' diff --git a/micrometer-test/build.gradle b/micrometer-test/build.gradle index 845d2376b7..1eff600d36 100644 --- a/micrometer-test/build.gradle +++ b/micrometer-test/build.gradle @@ -32,7 +32,7 @@ dependencies { api 'com.github.tomakehurst:wiremock-jre8-standalone' java11TestImplementation 'com.github.tomakehurst:wiremock-jre8-standalone' - api 'org.mockito:mockito-core' + api libs.mockitoCore4 implementation 'org.awaitility:awaitility' testImplementation project(':micrometer-observation-test') diff --git a/samples/micrometer-samples-hazelcast3/build.gradle b/samples/micrometer-samples-hazelcast3/build.gradle index 1d906418e5..c7e5f07535 100644 --- a/samples/micrometer-samples-hazelcast3/build.gradle +++ b/samples/micrometer-samples-hazelcast3/build.gradle @@ -12,4 +12,5 @@ dependencies { implementation 'ch.qos.logback:logback-classic' testImplementation project(':micrometer-test') + testImplementation libs.mockitoCore5 }