Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IpShot committed Nov 1, 2024
1 parent dea8dc3 commit f0744de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/test/java/com/ably/kafka/connect/AblyBatchClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public void testSendsAblyBatchApiRequests() throws ChannelSinkConnectorConfig.Co
)
);
assertEquals(Map.of(
new TopicPartition("topic1", 0), new OffsetAndMetadata(1),
new TopicPartition("topic1", 1), new OffsetAndMetadata(4)
new TopicPartition("topic1", 0), new OffsetAndMetadata(2),
new TopicPartition("topic1", 1), new OffsetAndMetadata(5)
), offsets);
}

Expand Down Expand Up @@ -334,8 +334,8 @@ public void testPartialFailureSendsFailedRecordsToDlq() throws ChannelSinkConnec
// Offset registry *should* have been updated for both partitions, as we've DLQ'ed failures
assertEquals(
Map.of(
new TopicPartition("topic1", 0), new OffsetAndMetadata(0),
new TopicPartition("topic1", 1), new OffsetAndMetadata(1)
new TopicPartition("topic1", 0), new OffsetAndMetadata(1),
new TopicPartition("topic1", 1), new OffsetAndMetadata(2)
), registry.updateOffsets(
Map.of(
new TopicPartition("topic1", 0), new OffsetAndMetadata(20),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public void testupdateTopicPartitionToOffsetMapRecordsInSameTopic() {
offsetRegistryService.updateTopicPartitionToOffsetMap(records);

Map<TopicPartition, Long> expectedResult = new HashMap<>();
expectedResult.put(new TopicPartition("topic1", 0), 3L);
expectedResult.put(new TopicPartition("topic1", 1), 2L);
expectedResult.put(new TopicPartition("topic1", 0), 4L);
expectedResult.put(new TopicPartition("topic1", 1), 3L);

assertEquals(offsetRegistryService.getTopicPartitionToOffsetMap(), expectedResult);
}
Expand Down Expand Up @@ -67,10 +67,10 @@ public void testupdateTopicPartitionToOffsetMapRecordsInMultipleTopics() {
offsetRegistryService.updateTopicPartitionToOffsetMap(records);

Map<TopicPartition, Long> expectedResult = new HashMap<>();
expectedResult.put(new TopicPartition("topic1", 0), 3L);
expectedResult.put(new TopicPartition("topic1", 1), 2L);
expectedResult.put(new TopicPartition("topic2", 0), 44444L);
expectedResult.put(new TopicPartition("topic2", 4), 22223L);
expectedResult.put(new TopicPartition("topic1", 0), 4L);
expectedResult.put(new TopicPartition("topic1", 1), 3L);
expectedResult.put(new TopicPartition("topic2", 0), 44445L);
expectedResult.put(new TopicPartition("topic2", 4), 22224L);

assertEquals(offsetRegistryService.getTopicPartitionToOffsetMap(), expectedResult);
}
Expand Down Expand Up @@ -105,8 +105,8 @@ public void testUpdateOffsets() {
Map<TopicPartition, OffsetAndMetadata> result = offsetRegistryService.updateOffsets(preCommitOffsets);

Map<TopicPartition, OffsetAndMetadata> expectedResult = new HashMap<>();
expectedResult.put(new TopicPartition("topic1", 0), new OffsetAndMetadata(3L));
expectedResult.put(new TopicPartition("topic1", 1), new OffsetAndMetadata(2L));
expectedResult.put(new TopicPartition("topic1", 0), new OffsetAndMetadata(4L));
expectedResult.put(new TopicPartition("topic1", 1), new OffsetAndMetadata(3L));

assertEquals(result, expectedResult);
}
Expand All @@ -131,10 +131,10 @@ public void testGetMaximumOffset() {
Map<TopicPartition, Long> maximumOffsetsMap = offsetRegistryService.getMaximumOffset(records);

Map<TopicPartition, Long> expectedResult = new HashMap<>();
expectedResult.put(new TopicPartition("topic1", 0), 3L);
expectedResult.put(new TopicPartition("topic1", 1), 2L);
expectedResult.put(new TopicPartition("topic1", 0), 4L);
expectedResult.put(new TopicPartition("topic1", 1), 3L);

expectedResult.put(new TopicPartition("topic2", 5), 4444444L);
expectedResult.put(new TopicPartition("topic2", 5), 4444445L);
assertEquals(maximumOffsetsMap, expectedResult);
}
}

0 comments on commit f0744de

Please sign in to comment.