diff --git a/data-prepper-core/src/integrationTest/java/org/opensearch/dataprepper/plugins/InMemorySinkAccessor.java b/data-prepper-core/src/integrationTest/java/org/opensearch/dataprepper/plugins/InMemorySinkAccessor.java index 77d659f816..21f359f361 100644 --- a/data-prepper-core/src/integrationTest/java/org/opensearch/dataprepper/plugins/InMemorySinkAccessor.java +++ b/data-prepper-core/src/integrationTest/java/org/opensearch/dataprepper/plugins/InMemorySinkAccessor.java @@ -34,7 +34,7 @@ public class InMemorySinkAccessor { public List> get(final String testingKey) { lock.lock(); try { - return recordsMap.getOrDefault(testingKey, Collections.emptyList()); + return new ArrayList<>(recordsMap.getOrDefault(testingKey, Collections.emptyList())); } finally { lock.unlock(); } @@ -49,7 +49,7 @@ public List> get(final String testingKey) { public List> getAndClear(final String testingKey) { lock.lock(); try { - final List> records = recordsMap.getOrDefault(testingKey, Collections.emptyList()); + final List> records = get(testingKey); recordsMap.remove(testingKey);