|
16 | 16 | import org.apache.kafka.clients.admin.ListTopicsResult; |
17 | 17 | import org.apache.kafka.common.KafkaFuture; |
18 | 18 | import org.junit.jupiter.api.BeforeEach; |
19 | | -import org.junit.jupiter.api.Disabled; |
20 | 19 | import org.junit.jupiter.api.Test; |
21 | 20 | import org.junit.jupiter.api.extension.ExtendWith; |
22 | 21 | import org.mockito.Mock; |
@@ -68,42 +67,6 @@ public void getAdminClient1() throws Exception { |
68 | 67 | } |
69 | 68 | } |
70 | 69 |
|
71 | | - @Test |
72 | | - @Disabled |
73 | | - public void getAdminClient2() throws Exception { |
74 | | - try (MockedStatic<AdminClient> mocked = mockStatic(AdminClient.class)) { |
75 | | - mocked.when(() -> AdminClient.create(any(Properties.class))).thenReturn(adminClient); |
76 | | - // Commented out to avoid UnnecessaryStubbingException |
77 | | - // when(env.getProperty(any())).thenReturn("true"); |
78 | | - when(adminClient.listTopics()).thenReturn(listTopicsResult); |
79 | | - when(listTopicsResult.names()).thenReturn(kafkaFuture); |
80 | | - Set<String> setStr = new HashSet<>(); |
81 | | - when(kafkaFuture.get()).thenReturn(setStr); |
82 | | - |
83 | | - AdminClient result = |
84 | | - getAdminClient.getAdminClient(LOCALHOST_9092, KafkaSupportedProtocol.PLAINTEXT, ""); |
85 | | - assertThat(result).isNotNull(); |
86 | | - } |
87 | | - } |
88 | | - |
89 | | - @Test |
90 | | - @Disabled |
91 | | - public void getAdminClient3() throws Exception { |
92 | | - try (MockedStatic<AdminClient> mocked = mockStatic(AdminClient.class)) { |
93 | | - mocked.when(() -> AdminClient.create(any(Properties.class))).thenReturn(adminClient); |
94 | | - // Commented out to avoid UnnecessaryStubbingException |
95 | | - when(env.getProperty(any())).thenReturn("false"); |
96 | | - when(adminClient.listTopics()).thenReturn(listTopicsResult); |
97 | | - when(listTopicsResult.names()).thenReturn(kafkaFuture); |
98 | | - Set<String> setStr = new HashSet<>(); |
99 | | - when(kafkaFuture.get()).thenReturn(setStr); |
100 | | - |
101 | | - AdminClient result = |
102 | | - getAdminClient.getAdminClient(LOCALHOST_9092, KafkaSupportedProtocol.PLAINTEXT, ""); |
103 | | - assertThat(result).isNotNull(); |
104 | | - } |
105 | | - } |
106 | | - |
107 | 70 | @Test |
108 | 71 | public void getPlainProperties() { |
109 | 72 | Properties props = getAdminClient.getPlainProperties(LOCALHOST); |
|
0 commit comments