|
18 | 18 | package org.apache.beam.sdk.io.kafka; |
19 | 19 |
|
20 | 20 | import static org.junit.Assert.assertEquals; |
21 | | -import static org.junit.Assert.assertTrue; |
22 | 21 | import static org.mockito.Mockito.never; |
23 | 22 | import static org.mockito.Mockito.verify; |
24 | 23 | import static org.mockito.Mockito.when; |
25 | 24 |
|
26 | | -import java.util.Collections; |
27 | 25 | import java.util.Set; |
28 | 26 | import java.util.regex.Pattern; |
29 | 27 | import org.apache.beam.sdk.io.kafka.KafkaMocks.PartitionGrowthMockConsumer; |
@@ -110,47 +108,6 @@ public void testGetAllTopicPartitionsWithGivenTopics() throws Exception { |
110 | 108 | (input) -> mockConsumer, null, givenTopics, null)); |
111 | 109 | } |
112 | 110 |
|
113 | | - @Test |
114 | | - public void testGetAllTopicPartitionsWithNullPartitionInfo() throws Exception { |
115 | | - Set<String> givenTopics = ImmutableSet.of("topic1"); |
116 | | - |
117 | | - Consumer<byte[], byte[]> mockConsumer = Mockito.mock(Consumer.class); |
118 | | - when(mockConsumer.partitionsFor("topic1")).thenReturn(null); |
119 | | - assertTrue( |
120 | | - WatchForKafkaTopicPartitions.getAllTopicPartitions( |
121 | | - (input) -> mockConsumer, null, givenTopics, null) |
122 | | - .isEmpty()); |
123 | | - } |
124 | | - |
125 | | - @Test |
126 | | - public void testGetAllTopicPartitionsWithEmptyPartitionInfo() throws Exception { |
127 | | - Set<String> givenTopics = ImmutableSet.of("topic1"); |
128 | | - |
129 | | - Consumer<byte[], byte[]> mockConsumer = Mockito.mock(Consumer.class); |
130 | | - when(mockConsumer.partitionsFor("topic1")).thenReturn(Collections.emptyList()); |
131 | | - assertTrue( |
132 | | - WatchForKafkaTopicPartitions.getAllTopicPartitions( |
133 | | - (input) -> mockConsumer, null, givenTopics, null) |
134 | | - .isEmpty()); |
135 | | - } |
136 | | - |
137 | | - @Test |
138 | | - public void testGetAllTopicPartitionsSkipsMissingTopics() throws Exception { |
139 | | - Set<String> givenTopics = ImmutableSet.of("topic1", "topic2"); |
140 | | - |
141 | | - Consumer<byte[], byte[]> mockConsumer = Mockito.mock(Consumer.class); |
142 | | - when(mockConsumer.partitionsFor("topic1")).thenReturn(null); |
143 | | - when(mockConsumer.partitionsFor("topic2")) |
144 | | - .thenReturn( |
145 | | - ImmutableList.of( |
146 | | - new PartitionInfo("topic2", 0, null, null, null), |
147 | | - new PartitionInfo("topic2", 1, null, null, null))); |
148 | | - assertEquals( |
149 | | - ImmutableList.of(new TopicPartition("topic2", 0), new TopicPartition("topic2", 1)), |
150 | | - WatchForKafkaTopicPartitions.getAllTopicPartitions( |
151 | | - (input) -> mockConsumer, null, givenTopics, null)); |
152 | | - } |
153 | | - |
154 | 111 | @Test |
155 | 112 | public void testGetAllTopicPartitionsWithGivenPattern() throws Exception { |
156 | 113 | Consumer<byte[], byte[]> mockConsumer = Mockito.mock(Consumer.class); |
|
0 commit comments