Skip to content

Commit

Permalink
Fix mock in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Sep 28, 2023
1 parent ae642f8 commit 742e76e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 742e76e

Please sign in to comment.