From 72e5079d56133bfd930a66dae22a249d26cb877b Mon Sep 17 00:00:00 2001 From: Rafael Winterhalter Date: Thu, 28 Sep 2023 12:57:49 +0200 Subject: [PATCH] Add toString function to support tests. --- .../apm/agent/report/serialize/DslJsonDataWriter.java | 5 +++++ .../micrometer/MicrometerMeterRegistrySerializerTest.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonDataWriter.java b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonDataWriter.java index af2f3f6b3f..dd76658a92 100644 --- a/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonDataWriter.java +++ b/apm-agent-core/src/main/java/co/elastic/apm/agent/report/serialize/DslJsonDataWriter.java @@ -117,4 +117,9 @@ public int size() { public void report() { reporter.reportMetrics(jw); } + + @Override + public String toString() { + return jw.toString(); + } } diff --git a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java index 5481763853..f47dc58f5b 100644 --- a/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java +++ b/apm-agent-plugins/apm-micrometer-plugin/src/test/java/co/elastic/apm/agent/micrometer/MicrometerMeterRegistrySerializerTest.java @@ -65,8 +65,8 @@ static void setup() { when(tracer.newWriter(anyInt())).thenAnswer(new Answer() { @Override public DataWriter answer(InvocationOnMock invocationOnMock) { - int size = invocationOnMock.getArgument(0); - return new DslJsonDataWriter(dslJson.newWriter(size), reporter); + int maxSerializedSize = invocationOnMock.getArgument(0); + return new DslJsonDataWriter(dslJson.newWriter(maxSerializedSize), reporter); } }); serializer = new MicrometerMeterRegistrySerializer(config, tracer);