Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed tests for destination connectors #19007

Merged
merged 3 commits into from
Nov 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,7 @@ protected void runSyncAndVerifyStateOutput(final JsonNode config,
final List<AirbyteMessage> destinationOutput = runSync(config, messages, catalog,
runNormalization);

Collections.reverse(messages);
final AirbyteMessage expectedStateMessage = messages
final AirbyteMessage expectedStateMessage = reversed(messages)
.stream()
.filter(m -> m.getType() == Type.STATE)
.findFirst()
Expand All @@ -1238,6 +1237,20 @@ protected void runSyncAndVerifyStateOutput(final JsonNode config,
assertEquals(expectedStateMessage, actualStateMessage);
}

/**
* Reverses a list by creating a new list with the same elements of the input list and then
* reversing it. The input list will not be altered.
*
* @param list to reverse
* @param <T> type
* @return new list with elements of original reversed.
*/
public static <T> List<T> reversed(final List<T> list) {
final ArrayList<T> reversed = new ArrayList<>(list);
Collections.reverse(reversed);
return reversed;
}

private List<AirbyteMessage> runSync(
final JsonNode config,
final List<AirbyteMessage> messages,
Expand Down