4646import java .time .Duration ;
4747import java .util .ArrayList ;
4848import java .util .Arrays ;
49+ import java .util .Collection ;
4950import java .util .Collections ;
5051import java .util .HashMap ;
5152import java .util .List ;
5455import java .util .UUID ;
5556import java .util .concurrent .ExecutionException ;
5657import java .util .stream .Collectors ;
57- import java .util .stream .Stream ;
5858
5959import static java .util .Arrays .asList ;
6060import static org .apache .kafka .clients .admin .AdminClientConfig .METRIC_REPORTER_CLASSES_CONFIG ;
@@ -123,13 +123,12 @@ public void testClientInstanceId(ClusterInstance clusterInstance) throws Interru
123123 }
124124 }
125125
126- @ SuppressWarnings ("unchecked" )
127126 @ ClusterTest (types = {Type .CO_KRAFT , Type .KRAFT })
128127 public void testIntervalMsParser (ClusterInstance clusterInstance ) {
129128 List <String > alterOpts = asList ("--bootstrap-server" , clusterInstance .bootstrapServers (),
130129 "--alter" , "--entity-type" , "client-metrics" , "--entity-name" , "test" , "--add-config" , "interval.ms=bbb" );
131130 try (Admin client = clusterInstance .admin ()) {
132- ConfigCommand .ConfigCommandOptions addOpts = new ConfigCommand .ConfigCommandOptions (toArray (alterOpts ));
131+ ConfigCommand .ConfigCommandOptions addOpts = new ConfigCommand .ConfigCommandOptions (toArray (Set . of ( alterOpts ) ));
133132
134133 Throwable e = assertThrows (ExecutionException .class , () -> ConfigCommand .alterConfig (client , addOpts ));
135134 assertTrue (e .getMessage ().contains (InvalidConfigurationException .class .getSimpleName ()));
@@ -153,16 +152,16 @@ public void testMetrics(ClusterInstance clusterInstance) {
153152 }
154153 }
155154
156- @ SuppressWarnings ("unchecked" )
157- private static String [] toArray (List <String >... lists ) {
158- return Stream .of (lists ).flatMap (List ::stream ).toArray (String []::new );
155+ private static String [] toArray (Collection <List <String >> lists ) {
156+ return lists .stream ().flatMap (List ::stream ).toArray (String []::new );
159157 }
160158
161159 /**
162160 * We should add a ClientTelemetry into plugins to test the clientInstanceId method Otherwise the
163161 * {@link org.apache.kafka.common.protocol.ApiKeys#GET_TELEMETRY_SUBSCRIPTIONS} command will not be supported
164162 * by the server
165163 **/
164+ @ SuppressWarnings ("unused" )
166165 public static class GetIdClientTelemetry implements ClientTelemetry , MetricsReporter {
167166
168167
0 commit comments