Skip to content

Commit 16a2044

Browse files
committed
Fix warnings
1 parent 044b9c9 commit 16a2044

File tree

10 files changed

+175
-200
lines changed

10 files changed

+175
-200
lines changed

src/systemTest/java/com/hivemq/cli/commands/cli/publish/PublishConnectMTlsST.java

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ class PublishConnectMTlsST {
5353
.build();
5454

5555
@RegisterExtension
56-
@SuppressWarnings("JUnitMalformedDeclaration")
5756
private final @NotNull MqttCliAsyncExtension mqttCli = new MqttCliAsyncExtension();
5857

59-
6058
//KEYSTORE / TRUSTSTORE
6159

6260
@CartesianTest
@@ -101,11 +99,11 @@ void test_similar_private_key_password_keystore_truststore_mutualTls(
10199
executionResult.awaitStdOut("Enter truststore password:");
102100
executionResult.write("clientTruststorePassword");
103101
executionResult.awaitStdOut("finish PUBLISH");
104-
assertConnectPacket(hivemq.getConnectPackets().get(0),
102+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
105103
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
106104
mqttVersion)));
107105

108-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
106+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
109107
publishAssertion.setTopic("test");
110108
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
111109
});
@@ -154,11 +152,11 @@ void test_keystore_truststore_mutualTls(
154152
executionResult.awaitStdOut("Enter truststore password:");
155153
executionResult.write("clientTruststorePassword");
156154
executionResult.awaitStdOut("finish PUBLISH");
157-
assertConnectPacket(hivemq.getConnectPackets().get(0),
155+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
158156
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
159157
mqttVersion)));
160158

161-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
159+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
162160
publishAssertion.setTopic("test");
163161
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
164162
});
@@ -207,11 +205,11 @@ void test_password_arguments_keystore_truststore_mutualTls(
207205

208206
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand);
209207
executionResult.awaitStdOut("finish PUBLISH");
210-
assertConnectPacket(hivemq.getConnectPackets().get(0),
208+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
211209
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
212210
mqttVersion)));
213211

214-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
212+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
215213
publishAssertion.setTopic("test");
216214
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
217215
});
@@ -260,11 +258,11 @@ void test_properties_keystore_truststore_mutualTls(
260258

261259
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand, Map.of(), properties);
262260
executionResult.awaitStdOut("finish PUBLISH");
263-
assertConnectPacket(hivemq.getConnectPackets().get(0),
261+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
264262
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
265263
mqttVersion)));
266264

267-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
265+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
268266
publishAssertion.setTopic("test");
269267
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
270268
});
@@ -311,11 +309,11 @@ void test_unencrypted_pem_private_keys_mutualTls(
311309

312310
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand);
313311
executionResult.awaitStdOut("finish PUBLISH");
314-
assertConnectPacket(hivemq.getConnectPackets().get(0),
312+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
315313
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
316314
mqttVersion)));
317315

318-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
316+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
319317
publishAssertion.setTopic("test");
320318
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
321319
});
@@ -366,11 +364,11 @@ void test_encrypted_pem_private_keys_mutualTls(
366364
executionResult.awaitStdOut("Enter private key password:");
367365
executionResult.write("clientKeyPassword");
368366
executionResult.awaitStdOut("finish PUBLISH");
369-
assertConnectPacket(hivemq.getConnectPackets().get(0),
367+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
370368
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
371369
mqttVersion)));
372370

373-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
371+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
374372
publishAssertion.setTopic("test");
375373
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
376374
});
@@ -421,11 +419,11 @@ void test_password_arguments_encrypted_pem_private_keys_mutualTls(
421419

422420
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand);
423421
executionResult.awaitStdOut("finish PUBLISH");
424-
assertConnectPacket(hivemq.getConnectPackets().get(0),
422+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
425423
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
426424
mqttVersion)));
427425

428-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
426+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
429427
publishAssertion.setTopic("test");
430428
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
431429
});
@@ -477,11 +475,11 @@ void test_properties_encrypted_pem_private_keys_mutualTls(
477475

478476
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand, Map.of(), properties);
479477
executionResult.awaitStdOut("finish PUBLISH");
480-
assertConnectPacket(hivemq.getConnectPackets().get(0),
478+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
481479
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
482480
mqttVersion)));
483481

484-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
482+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
485483
publishAssertion.setTopic("test");
486484
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
487485
});
@@ -529,11 +527,11 @@ void test_unencrypted_der_private_keys_mutualTls(
529527

530528
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand);
531529
executionResult.awaitStdOut("finish PUBLISH");
532-
assertConnectPacket(hivemq.getConnectPackets().get(0),
530+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
533531
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
534532
mqttVersion)));
535533

536-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
534+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
537535
publishAssertion.setTopic("test");
538536
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
539537
});
@@ -586,11 +584,11 @@ void test_encrypted_der_private_keys_mutualTls(
586584
executionResult.awaitStdOut("Enter private key password:");
587585
executionResult.write("clientKeyPassword");
588586
executionResult.awaitStdOut("finish PUBLISH");
589-
assertConnectPacket(hivemq.getConnectPackets().get(0),
587+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
590588
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
591589
mqttVersion)));
592590

593-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
591+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
594592
publishAssertion.setTopic("test");
595593
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
596594
});
@@ -645,11 +643,11 @@ void test_password_arguments_encrypted_der_private_keys_mutualTls(
645643
executionResult.awaitStdOut("Enter private key password:");
646644
executionResult.write("clientKeyPassword");
647645
executionResult.awaitStdOut("finish PUBLISH");
648-
assertConnectPacket(hivemq.getConnectPackets().get(0),
646+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
649647
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
650648
mqttVersion)));
651649

652-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
650+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
653651
publishAssertion.setTopic("test");
654652
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
655653
});
@@ -703,11 +701,11 @@ void test_properties_encrypted_der_private_keys_mutualTls(
703701

704702
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand, Map.of(), properties);
705703
executionResult.awaitStdOut("finish PUBLISH");
706-
assertConnectPacket(hivemq.getConnectPackets().get(0),
704+
assertConnectPacket(hivemq.getConnectPackets().getFirst(),
707705
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
708706
mqttVersion)));
709707

710-
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
708+
assertPublishPacket(hivemq.getPublishPackets().getFirst(), publishAssertion -> {
711709
publishAssertion.setTopic("test");
712710
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
713711
});

0 commit comments

Comments
 (0)