diff --git a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java index 8899cdcc56..6d5f5d6a89 100644 --- a/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java +++ b/apm-agent-core/src/test/java/co/elastic/apm/agent/MockReporter.java @@ -78,9 +78,9 @@ public class MockReporter implements Reporter { // And for any case the disablement of the check cannot rely on subtype (eg Redis, where Jedis supports and Lettuce does not) private boolean disableDestinationAddressCheck; - private final List transactions = new ArrayList<>(); - private final List spans = new ArrayList<>(); - private final List errors = new ArrayList<>(); + private final List transactions = Collections.synchronizedList(new ArrayList<>()); + private final List spans = Collections.synchronizedList(new ArrayList<>()); + private final List errors = Collections.synchronizedList(new ArrayList<>()); private final ObjectMapper objectMapper; private final boolean verifyJsonSchema; private boolean closed;