diff --git a/build.gradle b/build.gradle index 5e3c44f2..01aa6e50 100644 --- a/build.gradle +++ b/build.gradle @@ -165,7 +165,7 @@ subprojects { openTelemetryContribVersion = '1.39.0' junitVersion = '4.13' junit5Version = '5.10.0' - mockitoVersion = '3.5.10' + mockitoVersion = '5.2.0' pubSubVersion = '1.133.0' testContainersVersion = '1.15.1' wiremockVersion = '2.35.0' diff --git a/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/GoogleCloudMetricExporterTest.java b/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/GoogleCloudMetricExporterTest.java index 68ff8120..fb7bcc74 100644 --- a/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/GoogleCloudMetricExporterTest.java +++ b/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/GoogleCloudMetricExporterTest.java @@ -171,7 +171,7 @@ public void testCreateWithMetricServiceSettingExportSucceeds() throws IOExceptio // verify that the MetricServiceClient used in the exporter was created using the // MetricServiceSettings provided in configuration mockedServiceClientClass.verify( - times(1), () -> MetricServiceClient.create(eq(configuration.getMetricServiceSettings()))); + () -> MetricServiceClient.create(eq(configuration.getMetricServiceSettings())), times(1)); // verify that export operation on the resulting exporter can still be called CompletableResultCode result = exporter.export(ImmutableList.of(aMetricData, aHistogram)); @@ -816,9 +816,9 @@ public void verifyExporterWorksWithDefaultConfiguration() { simulateExport(metricExporter); mockedMetricServiceClient.verify( - Mockito.times(1), - () -> MetricServiceClient.create((MetricServiceSettings) Mockito.any())); - mockedServiceOptions.verify(Mockito.times(1), ServiceOptions::getDefaultProjectId); + () -> MetricServiceClient.create((MetricServiceSettings) Mockito.any()), + Mockito.times(1)); + mockedServiceOptions.verify(ServiceOptions::getDefaultProjectId, Mockito.times(1)); Mockito.verify(this.mockMetricServiceClient) .createTimeSeries((ProjectName) Mockito.any(), Mockito.anyList()); } finally { diff --git a/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/MetricConfigurationTest.java b/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/MetricConfigurationTest.java index 62add406..a0a84180 100644 --- a/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/MetricConfigurationTest.java +++ b/exporters/metrics/src/test/java/com/google/cloud/opentelemetry/metric/MetricConfigurationTest.java @@ -107,7 +107,7 @@ public void testConfigurationWithDefaultProjectIdSucceeds() { MetricConfiguration configuration = MetricConfiguration.builder().build(); assertEquals(PROJECT_ID, configuration.getProjectId()); - serviceOptionsMockedStatic.verify(Mockito.times(1), ServiceOptions::getDefaultProjectId); + serviceOptionsMockedStatic.verify(ServiceOptions::getDefaultProjectId, Mockito.times(1)); } } @@ -127,7 +127,7 @@ public void verifyCallToDefaultProjectIdIsMemoized() { metricConfiguration2.getProjectId(); // ServiceOptions#getDefaultProjectId should only be called once per TraceConfiguration object - serviceOptionsMockedStatic.verify(Mockito.times(2), ServiceOptions::getDefaultProjectId); + serviceOptionsMockedStatic.verify(ServiceOptions::getDefaultProjectId, Mockito.times(2)); } } } diff --git a/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceConfigurationTest.java b/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceConfigurationTest.java index a1962b7f..dc5e190e 100644 --- a/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceConfigurationTest.java +++ b/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceConfigurationTest.java @@ -98,7 +98,7 @@ public void allowToUseDefaultProjectId() { TraceConfiguration traceConfiguration = TraceConfiguration.builder().build(); assertEquals(PROJECT_ID, traceConfiguration.getProjectId()); - mockedServiceOptions.verify(Mockito.times(1), ServiceOptions::getDefaultProjectId); + mockedServiceOptions.verify(ServiceOptions::getDefaultProjectId, Mockito.times(1)); } } @@ -164,7 +164,7 @@ public void verifyCallToDefaultProjectIdIsMemoize() { traceConfiguration2.getProjectId(); // ServiceOptions#getDefaultProjectId should only be called once per TraceConfiguration object - serviceOptionsMockedStatic.verify(Mockito.times(2), ServiceOptions::getDefaultProjectId); + serviceOptionsMockedStatic.verify(ServiceOptions::getDefaultProjectId, Mockito.times(2)); } } } diff --git a/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceExporterTest.java b/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceExporterTest.java index 4ff755e2..13388e73 100644 --- a/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceExporterTest.java +++ b/exporters/trace/src/test/java/com/google/cloud/opentelemetry/trace/TraceExporterTest.java @@ -101,8 +101,8 @@ public void verifyExporterWorksWithDefaultConfiguration() { simulateExport(exporter); mockedTraceServiceClient.verify( - Mockito.times(1), () -> TraceServiceClient.create((TraceServiceSettings) Mockito.any())); - mockedServiceOptions.verify(Mockito.times(1), ServiceOptions::getDefaultProjectId); + () -> TraceServiceClient.create((TraceServiceSettings) Mockito.any()), Mockito.times(1)); + mockedServiceOptions.verify(ServiceOptions::getDefaultProjectId, Mockito.times(1)); Mockito.verify(this.mockedTraceServiceClient) .batchWriteSpans((ProjectName) Mockito.any(), Mockito.anyList()); }