aashish-confluent commented on code in PR #24015:
URL: https://github.com/apache/kafka/pull/24015#discussion_r4439562804
##########
streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableImplTest.java:
##########
@@ -656,4 +661,20 @@ public void
shouldThrowNullPointerOnTransformValuesWithKeyWhenStoreNamesNull(fin
setDslStoreFormat(withHeaders);
assertThrows(NullPointerException.class, () ->
table.transformValues(mock(), (String[]) null));
}
+
+ @Test
+ public void shouldUseForeignKeyJoinResponsePartitionWhenValid() {
+ final KTableImpl.DefaultForeignResponseSinkPartitioner<String, String>
partitioner = new KTableImpl.DefaultForeignResponseSinkPartitioner<>();
+ assertEquals(Optional.of(Set.of(0)), partitioner.partitions("topic",
"key", new SubscriptionResponseWrapper<>(null, "value", 0), new
RecordHeaders(), 3));
+ assertEquals(Optional.of(Set.of(2)), partitioner.partitions("topic",
"key", new SubscriptionResponseWrapper<>(null, "value", 2), new
RecordHeaders(), 3));
+ assertEquals(Optional.empty(), partitioner.partitions("topic", "key",
new SubscriptionResponseWrapper<>(null, "value", null), new RecordHeaders(),
3));
+ }
+
+ @Test
+ public void
shouldUseDefaultPartitionerForInvalidForeignKeyJoinResponsePartition() {
+ final KTableImpl.DefaultForeignResponseSinkPartitioner<String, String>
partitioner = new KTableImpl.DefaultForeignResponseSinkPartitioner<>();
+ assertEquals(Optional.empty(), partitioner.partitions("topic", "key",
new SubscriptionResponseWrapper<>(null, "value", -1), new RecordHeaders(), 3));
+ assertEquals(Optional.empty(), partitioner.partitions("topic", "key",
new SubscriptionResponseWrapper<>(null, "value", 3), new RecordHeaders(), 3));
+ assertEquals(Optional.empty(), partitioner.partitions("topic", "key",
new SubscriptionResponseWrapper<>(null, "value", Integer.MAX_VALUE), new
RecordHeaders(), 3));
+ }
Review Comment:
Addressed, both tests are parameterized now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]