From 742e76efa913db9f5c9c60cec0a2467bd0c324a3 Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Thu, 28 Sep 2023 16:40:04 +0200 Subject: [PATCH] Fix mock in test. --- .../apm/agent/configuration/ConfigurationExporterTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java b/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java index 22e8534486..4e1d1ce90c 100644 --- a/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java +++ b/apm-agent-builds/apm-agent/src/test/java/co/elastic/apm/agent/configuration/ConfigurationExporterTest.java @@ -23,6 +23,7 @@ import co.elastic.apm.agent.tracer.GlobalTracer; import co.elastic.apm.agent.impl.Tracer; import co.elastic.apm.agent.sdk.ElasticApmInstrumentation; +import co.elastic.apm.agent.tracer.reporting.ReportingTracer; import co.elastic.apm.agent.util.DependencyInjectingServiceLoader; import freemarker.template.Configuration; import freemarker.template.Template; @@ -53,6 +54,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; /** * This is not an actual test. @@ -88,6 +90,7 @@ class ConfigurationExporterTest { void setUp() { renderedDocumentationPath = Paths.get("../../docs/configuration.asciidoc"); ElasticApmTracer tracer = mock(ElasticApmTracer.class); + when(tracer.require(ReportingTracer.class)).thenReturn(tracer); doReturn(tracer).when(tracer).require(ElasticApmTracer.class); doReturn(Tracer.TracerState.UNINITIALIZED).when(tracer).getState(); GlobalTracer.init(tracer);