From 08c8139138d1b6a6d08fe217f3edd4d671d5f119 Mon Sep 17 00:00:00 2001 From: Stephane Geneix Date: Fri, 19 Jul 2024 11:15:32 -0700 Subject: [PATCH] cdk-java: fix RecordDiffer --- .../base/destination/typing_deduping/RecordDiffer.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt index 0b09dd27279e7..80e92d88e3a2e 100644 --- a/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt +++ b/airbyte-cdk/java/airbyte-cdk/typing-deduping/src/testFixtures/kotlin/io/airbyte/integrations/base/destination/typing_deduping/RecordDiffer.kt @@ -15,7 +15,6 @@ import java.util.* import java.util.function.Function import java.util.stream.Collectors import java.util.stream.IntStream -import java.util.stream.Stream import kotlin.Array import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.function.Executable @@ -366,11 +365,9 @@ constructor( } else if (expectedValue is ObjectNode && actualValue is ObjectNode) { // If both values are objects compare their fields and values expectedValue.size() == actualValue.size() && - Stream.generate { expectedValue.fieldNames().next() } - .limit(expectedValue.size().toLong()) - .allMatch { field: String -> - areJsonNodesEquivalent(expectedValue[field], actualValue[field]) - } + expectedValue.fieldNames().asSequence().all { field: String -> + areJsonNodesEquivalent(expectedValue[field], actualValue[field]) + } } else { // Otherwise, we need to compare the actual values. // This is kind of sketchy, but seems to work fine for the data we have in our test