You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ab...@apache.org on 2022/08/15 18:16:42 UTC

[kafka] branch trunk updated: MINOR: Add setting input partitions for task mocks (#12510)

This is an automated email from the ASF dual-hosted git repository.

ableegoldman pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 75d89931e01 MINOR: Add setting input partitions for task mocks (#12510)
75d89931e01 is described below

commit 75d89931e0159ce8747198d61d11a2d45a630103
Author: Bruno Cadonna <ca...@apache.org>
AuthorDate: Mon Aug 15 20:16:32 2022 +0200

    MINOR: Add setting input partitions for task mocks (#12510)
    
    We recently added a builder to create task mocks for unit
    tests. This PR adds the functionality to add input partitions
    to task mocks when the builder is used.
    
    Reviewers: Walker Carlson <wc...@confluent.io>, A. Sophie Blee-Goldman <ab...@apache.org>
---
 streams/src/test/java/org/apache/kafka/test/StreamsTestUtils.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/streams/src/test/java/org/apache/kafka/test/StreamsTestUtils.java b/streams/src/test/java/org/apache/kafka/test/StreamsTestUtils.java
index 20cade6d93a..94889104786 100644
--- a/streams/src/test/java/org/apache/kafka/test/StreamsTestUtils.java
+++ b/streams/src/test/java/org/apache/kafka/test/StreamsTestUtils.java
@@ -325,6 +325,11 @@ public final class StreamsTestUtils {
             return this;
         }
 
+        public TaskBuilder<T> withInputPartitions(final Set<TopicPartition> inputPartitions) {
+            when(task.inputPartitions()).thenReturn(inputPartitions);
+            return this;
+        }
+
         public T build() {
             return task;
         }