diff --git a/src/test/java/org/springframework/integration/aws/inbound/KinesisMessageDrivenChannelAdapterTests.java b/src/test/java/org/springframework/integration/aws/inbound/KinesisMessageDrivenChannelAdapterTests.java index dbc9e800..eb993684 100644 --- a/src/test/java/org/springframework/integration/aws/inbound/KinesisMessageDrivenChannelAdapterTests.java +++ b/src/test/java/org/springframework/integration/aws/inbound/KinesisMessageDrivenChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class KinesisMessageDrivenChannelAdapterTests { +class KinesisMessageDrivenChannelAdapterTests { private static final String STREAM1 = "stream1"; @@ -118,7 +118,7 @@ void setup() { @Test @SuppressWarnings({"unchecked", "rawtypes"}) - void testKinesisMessageDrivenChannelAdapter() { + void kinesisMessageDrivenChannelAdapter() { this.kinesisMessageDrivenChannelAdapter.start(); final Set shardOffsets = TestUtils.getPropertyValue(this.kinesisMessageDrivenChannelAdapter, "shardOffsets", Set.class); @@ -168,11 +168,11 @@ void testKinesisMessageDrivenChannelAdapter() { Map forLocking = TestUtils.getPropertyValue(this.kinesisMessageDrivenChannelAdapter, "shardConsumerManager.locks", Map.class); - await().untilAsserted(() -> assertThat(forLocking).hasSize(0)); + await().untilAsserted(() -> assertThat(forLocking).isEmpty()); final List consumerInvokers = TestUtils.getPropertyValue(this.kinesisMessageDrivenChannelAdapter, "consumerInvokers", List.class); - await().untilAsserted(() -> assertThat(consumerInvokers).hasSize(0)); + await().untilAsserted(() -> assertThat(consumerInvokers).isEmpty()); this.kinesisMessageDrivenChannelAdapter.setListenerMode(ListenerMode.batch); this.kinesisMessageDrivenChannelAdapter.setCheckpointMode(CheckpointMode.record); @@ -186,7 +186,7 @@ void testKinesisMessageDrivenChannelAdapter() { assertThat(message).isNotNull(); assertThat(message.getPayload()).isInstanceOf(List.class); List payload = (List) message.getPayload(); - assertThat(payload).size().isEqualTo(1); + assertThat(payload).hasSize(1); String record = payload.get(0); assertThat(record).isEqualTo("bar"); @@ -219,7 +219,7 @@ void testKinesisMessageDrivenChannelAdapter() { assertThat(message).isNotNull(); assertThat(message.getPayload()).isInstanceOf(List.class); List messagePayload = (List) message.getPayload(); - assertThat(messagePayload).size().isEqualTo(3); + assertThat(messagePayload).hasSize(3); Object messageSequenceNumberHeader = message.getHeaders().get(AwsHeaders.RECEIVED_SEQUENCE_NUMBER); assertThat(messageSequenceNumberHeader).isInstanceOf(List.class); @@ -235,9 +235,7 @@ void testKinesisMessageDrivenChannelAdapter() { assertThat(message).isNotNull(); assertThat(message.getPayload()).isInstanceOf(List.class); messagePayload = (List) message.getPayload(); - assertThat(messagePayload).size().isEqualTo(2); - assertThat(messagePayload).contains("bar"); - assertThat(messagePayload).contains("foobar"); + assertThat(messagePayload).containsExactly("bar", "foobar"); this.kinesisMessageDrivenChannelAdapter.stop(); @@ -245,7 +243,7 @@ void testKinesisMessageDrivenChannelAdapter() { @Test @SuppressWarnings("rawtypes") - void testResharding() throws InterruptedException { + void resharding() throws InterruptedException { this.reshardingChannelAdapter.start(); assertThat(this.kinesisChannel.receive(10000)).isNotNull(); diff --git a/src/test/java/org/springframework/integration/aws/inbound/S3InboundChannelAdapterTests.java b/src/test/java/org/springframework/integration/aws/inbound/S3InboundChannelAdapterTests.java index cdf02aa2..10cb3ce4 100644 --- a/src/test/java/org/springframework/integration/aws/inbound/S3InboundChannelAdapterTests.java +++ b/src/test/java/org/springframework/integration/aws/inbound/S3InboundChannelAdapterTests.java @@ -57,7 +57,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class S3InboundChannelAdapterTests implements LocalstackContainerTest { +class S3InboundChannelAdapterTests implements LocalstackContainerTest { private static final ExpressionParser PARSER = new SpelExpressionParser(); @@ -84,12 +84,12 @@ static void setup() { } @Test - void testS3InboundChannelAdapter() throws IOException { + void s3InboundChannelAdapter() throws IOException { Message message = this.s3FilesChannel.receive(10000); assertThat(message).isNotNull(); assertThat(message.getPayload()).isInstanceOf(File.class); File localFile = (File) message.getPayload(); - assertThat(localFile.getName()).isEqualTo("A.TEST.a"); + assertThat(localFile).hasName("A.TEST.a"); String content = FileCopyUtils.copyToString(new FileReader(localFile)); assertThat(content).isEqualTo("Hello"); @@ -98,7 +98,7 @@ void testS3InboundChannelAdapter() throws IOException { assertThat(message).isNotNull(); assertThat(message.getPayload()).isInstanceOf(File.class); localFile = (File) message.getPayload(); - assertThat(localFile.getName()).isEqualTo("B.TEST.a"); + assertThat(localFile).hasName("B.TEST.a"); content = FileCopyUtils.copyToString(new FileReader(localFile)); assertThat(content).isEqualTo("Bye"); diff --git a/src/test/java/org/springframework/integration/aws/inbound/S3StreamingChannelAdapterTests.java b/src/test/java/org/springframework/integration/aws/inbound/S3StreamingChannelAdapterTests.java index cd45d8e0..44814bde 100644 --- a/src/test/java/org/springframework/integration/aws/inbound/S3StreamingChannelAdapterTests.java +++ b/src/test/java/org/springframework/integration/aws/inbound/S3StreamingChannelAdapterTests.java @@ -56,7 +56,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class S3StreamingChannelAdapterTests implements LocalstackContainerTest { +class S3StreamingChannelAdapterTests implements LocalstackContainerTest { private static final String S3_BUCKET = "s3-bucket"; @@ -74,7 +74,7 @@ static void setup() { } @Test - void testS3InboundStreamingChannelAdapter() throws IOException { + void s3InboundStreamingChannelAdapter() throws IOException { Message message = this.s3FilesChannel.receive(10000); assertThat(message).isNotNull(); assertThat(message.getPayload()).isInstanceOf(InputStream.class); diff --git a/src/test/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapterTests.java b/src/test/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapterTests.java index ff78e270..8a6602cc 100644 --- a/src/test/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapterTests.java +++ b/src/test/java/org/springframework/integration/aws/inbound/SnsInboundChannelAdapterTests.java @@ -55,7 +55,7 @@ */ @SpringJUnitWebConfig @DirtiesContext -public class SnsInboundChannelAdapterTests { +class SnsInboundChannelAdapterTests { @Autowired private WebApplicationContext context; @@ -83,7 +83,7 @@ void setUp() { } @Test - void testSubscriptionConfirmation() throws Exception { + void subscriptionConfirmation() throws Exception { this.mockMvc .perform(post("/mySampleTopic").header("x-amz-sns-message-type", "SubscriptionConfirmation") .contentType(MediaType.APPLICATION_JSON) @@ -110,7 +110,7 @@ void testSubscriptionConfirmation() throws Exception { @Test @SuppressWarnings("unchecked") - void testNotification() throws Exception { + void notification() throws Exception { this.mockMvc .perform(post("/mySampleTopic").header("x-amz-sns-message-type", "Notification") .contentType(MediaType.TEXT_PLAIN) @@ -121,12 +121,13 @@ void testNotification() throws Exception { assertThat(receive).isNotNull(); Map payload = (Map) receive.getPayload(); - assertThat(payload.get("Subject")).isEqualTo("foo"); - assertThat(payload.get("Message")).isEqualTo("bar"); + assertThat(payload) + .containsEntry("Subject", "foo") + .containsEntry("Message", "bar"); } @Test - void testUnsubscribe() throws Exception { + void unsubscribe() throws Exception { this.mockMvc .perform(post("/mySampleTopic").header("x-amz-sns-message-type", "UnsubscribeConfirmation") .contentType(MediaType.TEXT_PLAIN) diff --git a/src/test/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapterTests.java b/src/test/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapterTests.java index cf1bfebd..1ba6fff5 100644 --- a/src/test/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapterTests.java +++ b/src/test/java/org/springframework/integration/aws/inbound/SqsMessageDrivenChannelAdapterTests.java @@ -43,7 +43,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class SqsMessageDrivenChannelAdapterTests implements LocalstackContainerTest { +class SqsMessageDrivenChannelAdapterTests implements LocalstackContainerTest { private static SqsAsyncClient AMAZON_SQS; @@ -59,7 +59,7 @@ static void setup() { } @Test - void testSqsMessageDrivenChannelAdapter() { + void sqsMessageDrivenChannelAdapter() { Map attributes = Map.of("someAttribute", MessageAttributeValue.builder() diff --git a/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterMultiStreamTests.java b/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterMultiStreamTests.java index 2ec10411..997a4b7f 100644 --- a/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterMultiStreamTests.java +++ b/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterMultiStreamTests.java @@ -53,8 +53,7 @@ */ @SpringJUnitConfig @DirtiesContext - -public class KclMessageDrivenChannelAdapterMultiStreamTests implements LocalstackContainerTest { +class KclMessageDrivenChannelAdapterMultiStreamTests implements LocalstackContainerTest { private static final String TEST_STREAM1 = "MultiStreamKcl1"; @@ -104,7 +103,7 @@ static void tearDown() { } @Test - public void kclChannelAdapterMultiStream() { + void kclChannelAdapterMultiStream() { String testData = "test data"; AMAZON_KINESIS.putRecord(request -> request .streamName(TEST_STREAM1) diff --git a/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterTests.java b/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterTests.java index e4c4830a..f6d8bd7a 100644 --- a/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterTests.java +++ b/src/test/java/org/springframework/integration/aws/kinesis/KclMessageDrivenChannelAdapterTests.java @@ -161,7 +161,7 @@ private Message verifyRecordReceived(String testData) { } @Test - public void metricsLevelOfMetricsConfigShouldBeSetToMetricsLevelOfAdapter() { + void metricsLevelOfMetricsConfigShouldBeSetToMetricsLevelOfAdapter() { MetricsLevel metricsLevel = TestUtils.getPropertyValue(this.kclMessageDrivenChannelAdapter, "scheduler.metricsConfig.metricsLevel", @@ -170,7 +170,7 @@ public void metricsLevelOfMetricsConfigShouldBeSetToMetricsLevelOfAdapter() { } @Test - public void metricsFactoryOfSchedulerShouldBeSetNullMetricsFactoryIfMetricsLevelIsNone() { + void metricsFactoryOfSchedulerShouldBeSetNullMetricsFactoryIfMetricsLevelIsNone() { MetricsFactory metricsFactory = TestUtils.getPropertyValue(this.kclMessageDrivenChannelAdapter, "scheduler.metricsFactory", @@ -179,7 +179,7 @@ public void metricsFactoryOfSchedulerShouldBeSetNullMetricsFactoryIfMetricsLevel } @Test - public void maxLeasesForWorkerOverriddenByCustomizer() { + void maxLeasesForWorkerOverriddenByCustomizer() { Integer maxLeasesForWorker = TestUtils.getPropertyValue(this.kclMessageDrivenChannelAdapter, "scheduler.leaseCoordinator.leaseTaker.maxLeasesForWorker", @@ -188,7 +188,7 @@ public void maxLeasesForWorkerOverriddenByCustomizer() { } @Test - public void shardConsumerDispatchPollIntervalMillisOverriddenByCustomizer() { + void shardConsumerDispatchPollIntervalMillisOverriddenByCustomizer() { Long shardConsumerDispatchPollIntervalMillis = TestUtils.getPropertyValue(this.kclMessageDrivenChannelAdapter, "scheduler.shardConsumerDispatchPollIntervalMillis", @@ -197,7 +197,7 @@ public void shardConsumerDispatchPollIntervalMillisOverriddenByCustomizer() { } @Test - public void pollingMaxRecordsIsPropagated() { + void pollingMaxRecordsIsPropagated() { Integer maxRecords = TestUtils.getPropertyValue(this.kclMessageDrivenChannelAdapter, "scheduler.retrievalConfig.retrievalSpecificConfig.maxRecords", diff --git a/src/test/java/org/springframework/integration/aws/kinesis/KinesisIntegrationTests.java b/src/test/java/org/springframework/integration/aws/kinesis/KinesisIntegrationTests.java index 0645deb3..bdedb97e 100644 --- a/src/test/java/org/springframework/integration/aws/kinesis/KinesisIntegrationTests.java +++ b/src/test/java/org/springframework/integration/aws/kinesis/KinesisIntegrationTests.java @@ -65,7 +65,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class KinesisIntegrationTests implements LocalstackContainerTest { +class KinesisIntegrationTests implements LocalstackContainerTest { private static final String TEST_STREAM = "TestStream"; @@ -95,7 +95,7 @@ static void tearDown() { } @Test - void testKinesisInboundOutbound() { + void kinesisInboundOutbound() { this.kinesisSendChannel .send(MessageBuilder.withPayload("foo").setHeader(AwsHeaders.STREAM, TEST_STREAM).build()); @@ -138,7 +138,7 @@ void testKinesisInboundOutbound() { assertThat(receivedSequences.add(sequenceNumber)).isTrue(); } - assertThat(receivedSequences.size()).isEqualTo(2); + assertThat(receivedSequences).hasSize(2); receive = this.kinesisReceiveChannel.receive(10); assertThat(receive).isNull(); diff --git a/src/test/java/org/springframework/integration/aws/kinesis/KplKclIntegrationTests.java b/src/test/java/org/springframework/integration/aws/kinesis/KplKclIntegrationTests.java index ac45e9a2..571ecd42 100644 --- a/src/test/java/org/springframework/integration/aws/kinesis/KplKclIntegrationTests.java +++ b/src/test/java/org/springframework/integration/aws/kinesis/KplKclIntegrationTests.java @@ -68,7 +68,7 @@ @Disabled("Depends on real call to http://169.254.169.254 through native library") @SpringJUnitConfig @DirtiesContext -public class KplKclIntegrationTests implements LocalstackContainerTest { +class KplKclIntegrationTests implements LocalstackContainerTest { private static final String TEST_STREAM = "TestStreamKplKcl"; @@ -105,7 +105,7 @@ static void tearDown() { } @Test - void testKinesisInboundOutbound() { + void kinesisInboundOutbound() { this.kinesisSendChannel .send(MessageBuilder.withPayload("foo").setHeader(AwsHeaders.STREAM, TEST_STREAM).build()); diff --git a/src/test/java/org/springframework/integration/aws/leader/DynamoDbLockRegistryLeaderInitiatorTests.java b/src/test/java/org/springframework/integration/aws/leader/DynamoDbLockRegistryLeaderInitiatorTests.java index c68aafc3..b12db474 100644 --- a/src/test/java/org/springframework/integration/aws/leader/DynamoDbLockRegistryLeaderInitiatorTests.java +++ b/src/test/java/org/springframework/integration/aws/leader/DynamoDbLockRegistryLeaderInitiatorTests.java @@ -75,7 +75,7 @@ static void destroy() { } @Test - void testDistributedLeaderElection() throws Exception { + void distributedLeaderElection() throws Exception { CountDownLatch granted = new CountDownLatch(1); CountingPublisher countingPublisher = new CountingPublisher(granted); List repositories = new ArrayList<>(); @@ -176,7 +176,7 @@ void testDistributedLeaderElection() throws Exception { } @Test - void testLostConnection() throws Exception { + void lostConnection() throws Exception { CountDownLatch granted = new CountDownLatch(1); CountingPublisher countingPublisher = new CountingPublisher(granted); diff --git a/src/test/java/org/springframework/integration/aws/lock/DynamoDbLockRegistryTests.java b/src/test/java/org/springframework/integration/aws/lock/DynamoDbLockRegistryTests.java index 0a1ad53e..4b60acfd 100644 --- a/src/test/java/org/springframework/integration/aws/lock/DynamoDbLockRegistryTests.java +++ b/src/test/java/org/springframework/integration/aws/lock/DynamoDbLockRegistryTests.java @@ -55,7 +55,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class DynamoDbLockRegistryTests implements LocalstackContainerTest { +class DynamoDbLockRegistryTests implements LocalstackContainerTest { private static DynamoDbAsyncClient DYNAMO_DB; @@ -98,7 +98,7 @@ void clear() throws InterruptedException { @Test @SuppressWarnings("unchecked") - void testLock() { + void lock() { for (int i = 0; i < 10; i++) { Lock lock = this.dynamoDbLockRegistry.obtain("foo"); lock.lock(); @@ -113,7 +113,7 @@ void testLock() { @Test @SuppressWarnings("unchecked") - void testLockInterruptibly() throws Exception { + void lockInterruptibly() throws Exception { for (int i = 0; i < 10; i++) { Lock lock = this.dynamoDbLockRegistry.obtain("foo"); lock.lockInterruptibly(); @@ -127,7 +127,7 @@ void testLockInterruptibly() throws Exception { } @Test - void testReentrantLock() { + void reentrantLock() { for (int i = 0; i < 10; i++) { Lock lock1 = this.dynamoDbLockRegistry.obtain("foo"); lock1.lock(); @@ -144,7 +144,7 @@ void testReentrantLock() { } @Test - void testReentrantLockInterruptibly() throws Exception { + void reentrantLockInterruptibly() throws Exception { for (int i = 0; i < 10; i++) { Lock lock1 = this.dynamoDbLockRegistry.obtain("foo"); lock1.lockInterruptibly(); @@ -161,7 +161,7 @@ void testReentrantLockInterruptibly() throws Exception { } @Test - void testTwoLocks() throws Exception { + void twoLocks() throws Exception { for (int i = 0; i < 10; i++) { Lock lock1 = this.dynamoDbLockRegistry.obtain("foo"); lock1.lockInterruptibly(); @@ -178,7 +178,7 @@ void testTwoLocks() throws Exception { } @Test - void testTwoThreadsSecondFailsToGetLock() throws Exception { + void twoThreadsSecondFailsToGetLock() throws Exception { final Lock lock1 = this.dynamoDbLockRegistry.obtain("foo"); lock1.lockInterruptibly(); final AtomicBoolean locked = new AtomicBoolean(); @@ -212,7 +212,7 @@ void testTwoThreadsSecondFailsToGetLock() throws Exception { } @Test - void testTwoThreads() throws Exception { + void twoThreads() throws Exception { final Lock lock1 = this.dynamoDbLockRegistry.obtain("foo"); final AtomicBoolean locked = new AtomicBoolean(); final CountDownLatch latch1 = new CountDownLatch(1); @@ -254,7 +254,7 @@ void testTwoThreads() throws Exception { } @Test - void testTwoThreadsDifferentRegistries() throws Exception { + void twoThreadsDifferentRegistries() throws Exception { DynamoDbLockRepository dynamoDbLockRepository = new DynamoDbLockRepository(DYNAMO_DB); dynamoDbLockRepository.setLeaseDuration(Duration.ofSeconds(10)); dynamoDbLockRepository.afterPropertiesSet(); @@ -299,7 +299,7 @@ void testTwoThreadsDifferentRegistries() throws Exception { } @Test - void testTwoThreadsWrongOneUnlocks() throws Exception { + void twoThreadsWrongOneUnlocks() throws Exception { final Lock lock = this.dynamoDbLockRegistry.obtain("foo"); lock.lockInterruptibly(); final AtomicBoolean locked = new AtomicBoolean(); @@ -343,7 +343,7 @@ void abandonedLock() throws Exception { } @Test - public void testLockRenew() { + void lockRenew() { final Lock lock = this.dynamoDbLockRegistry.obtain("foo"); assertThat(lock.tryLock()).isTrue(); diff --git a/src/test/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStoreTests.java b/src/test/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStoreTests.java index af3f2afa..215802bc 100644 --- a/src/test/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStoreTests.java +++ b/src/test/java/org/springframework/integration/aws/metadata/DynamoDbMetadataStoreTests.java @@ -87,7 +87,7 @@ void clear() throws InterruptedException { } @Test - void testGetFromStore() { + void getFromStore() { String fileID = store.get(this.file1); assertThat(fileID).isNull(); @@ -99,7 +99,7 @@ void testGetFromStore() { } @Test - void testPutIfAbsent() { + void putIfAbsent() { String fileID = store.get(this.file1); assertThat(fileID).describedAs("Get First time, Value must not exist").isNull(); @@ -114,7 +114,7 @@ void testPutIfAbsent() { } @Test - void testRemove() { + void remove() { String fileID = store.remove(this.file1); assertThat(fileID).isNull(); @@ -130,7 +130,7 @@ void testRemove() { } @Test - void testReplace() { + void replace() { boolean removedValue = store.replace(this.file1, this.file1Id, "4567"); assertThat(removedValue).isFalse(); diff --git a/src/test/java/org/springframework/integration/aws/outbound/KinesisMessageHandlerTests.java b/src/test/java/org/springframework/integration/aws/outbound/KinesisMessageHandlerTests.java index c337050d..4f7e4882 100644 --- a/src/test/java/org/springframework/integration/aws/outbound/KinesisMessageHandlerTests.java +++ b/src/test/java/org/springframework/integration/aws/outbound/KinesisMessageHandlerTests.java @@ -60,7 +60,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class KinesisMessageHandlerTests { +class KinesisMessageHandlerTests { @Autowired protected KinesisAsyncClient amazonKinesis; @@ -73,7 +73,7 @@ public class KinesisMessageHandlerTests { @Test @SuppressWarnings("unchecked") - void testKinesisMessageHandler() { + void kinesisMessageHandler() { final Message message = MessageBuilder.withPayload("message").build(); assertThatExceptionOfType(MessageHandlingException.class) diff --git a/src/test/java/org/springframework/integration/aws/outbound/KinesisProducingMessageHandlerTests.java b/src/test/java/org/springframework/integration/aws/outbound/KinesisProducingMessageHandlerTests.java index 17ea62cc..b99c8f87 100644 --- a/src/test/java/org/springframework/integration/aws/outbound/KinesisProducingMessageHandlerTests.java +++ b/src/test/java/org/springframework/integration/aws/outbound/KinesisProducingMessageHandlerTests.java @@ -61,7 +61,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class KinesisProducingMessageHandlerTests { +class KinesisProducingMessageHandlerTests { @Autowired protected MessageChannel kinesisSendChannel; @@ -76,7 +76,7 @@ public class KinesisProducingMessageHandlerTests { protected PollableChannel successChannel; @Test - public void testKinesisMessageHandler() { + void kinesisMessageHandler() { final Message message = MessageBuilder.withPayload("message") .setErrorChannel(this.errorChannel) diff --git a/src/test/java/org/springframework/integration/aws/outbound/S3MessageHandlerTests.java b/src/test/java/org/springframework/integration/aws/outbound/S3MessageHandlerTests.java index 48775de7..a445a95c 100644 --- a/src/test/java/org/springframework/integration/aws/outbound/S3MessageHandlerTests.java +++ b/src/test/java/org/springframework/integration/aws/outbound/S3MessageHandlerTests.java @@ -80,7 +80,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class S3MessageHandlerTests implements LocalstackContainerTest { +class S3MessageHandlerTests implements LocalstackContainerTest { private static S3AsyncClient S3; @@ -137,7 +137,7 @@ void prepareBucket() { } @Test - void testUploadFile() throws IOException, InterruptedException { + void uploadFile() throws IOException, InterruptedException { File file = new File(temporaryFolder.toFile(), "foo.mp3"); file.createNewFile(); byte[] testData = "test data".getBytes(); @@ -172,7 +172,7 @@ public void transferComplete(Context.TransferComplete context) { } @Test - void testUploadInputStream() throws IOException, InterruptedException { + void uploadInputStream() throws IOException, InterruptedException { Expression actualKeyExpression = TestUtils.getPropertyValue(this.s3MessageHandler, "keyExpression", Expression.class); @@ -221,7 +221,7 @@ public void transferComplete(Context.TransferComplete context) { } @Test - void testUploadByteArray() throws InterruptedException, IOException { + void uploadByteArray() throws InterruptedException, IOException { CountDownLatch transferCompletedLatch = new CountDownLatch(1); byte[] payload = "b".getBytes(StandardCharsets.UTF_8); Message message = @@ -257,7 +257,7 @@ public void transferComplete(Context.TransferComplete context) { } @Test - void testDownloadDirectory() throws IOException { + void downloadDirectory() throws IOException { CompletableFuture bb = S3.putObject(request -> request.bucket(S3_BUCKET_NAME).key(S3_FILE_KEY_BAR), AsyncRequestBody.fromString("bb")); @@ -280,7 +280,7 @@ void testDownloadDirectory() throws IOException { assertThat(directoryArray.length).isEqualTo(1); File subDirectory = directoryArray[0]; - assertThat(subDirectory.getName()).isEqualTo("subdir"); + assertThat(subDirectory).hasName("subdir"); // get the files we downloaded File[] fileArray = subDirectory.listFiles(); @@ -291,16 +291,16 @@ void testDownloadDirectory() throws IOException { files.sort(Comparator.comparing(File::getName)); File file1 = files.get(0); - assertThat(file1.getName()).isEqualTo(S3_FILE_KEY_BAR.split("/", 2)[1]); + assertThat(file1).hasName(S3_FILE_KEY_BAR.split("/", 2)[1]); assertThat(FileCopyUtils.copyToString(new FileReader(file1))).isEqualTo("bb"); File file2 = files.get(1); - assertThat(file2.getName()).isEqualTo(S3_FILE_KEY_FOO.split("/", 2)[1]); + assertThat(file2).hasName(S3_FILE_KEY_FOO.split("/", 2)[1]); assertThat(FileCopyUtils.copyToString(new FileReader(file2))).isEqualTo("f"); } @Test - void testCopy() throws IOException { + void copy() throws IOException { byte[] testData = "ff".getBytes(); CompletableFuture mySource = S3.putObject(request -> request.bucket(S3_BUCKET_NAME).key("mySource"), diff --git a/src/test/java/org/springframework/integration/aws/outbound/SnsBodyBuilderTests.java b/src/test/java/org/springframework/integration/aws/outbound/SnsBodyBuilderTests.java index 383f87a4..22fb5919 100644 --- a/src/test/java/org/springframework/integration/aws/outbound/SnsBodyBuilderTests.java +++ b/src/test/java/org/springframework/integration/aws/outbound/SnsBodyBuilderTests.java @@ -29,7 +29,7 @@ class SnsBodyBuilderTests { @Test - void testSnsBodyBuilder() { + void snsBodyBuilder() { assertThatIllegalArgumentException() .isThrownBy(() -> SnsBodyBuilder.withDefault("")) .withMessageContaining("defaultMessage must not be empty."); diff --git a/src/test/java/org/springframework/integration/aws/outbound/SnsMessageHandlerTests.java b/src/test/java/org/springframework/integration/aws/outbound/SnsMessageHandlerTests.java index 2d04a2d7..c3667b1a 100644 --- a/src/test/java/org/springframework/integration/aws/outbound/SnsMessageHandlerTests.java +++ b/src/test/java/org/springframework/integration/aws/outbound/SnsMessageHandlerTests.java @@ -59,7 +59,7 @@ */ @SpringJUnitConfig @DirtiesContext -public class SnsMessageHandlerTests { +class SnsMessageHandlerTests { private static final SpelExpressionParser PARSER = new SpelExpressionParser(); @@ -73,7 +73,7 @@ public class SnsMessageHandlerTests { private PollableChannel resultChannel; @Test - void testSnsMessageHandler() { + void snsMessageHandler() { SnsBodyBuilder payload = SnsBodyBuilder.withDefault("foo").forProtocols("{\"foo\" : \"bar\"}", "sms"); Message message = MessageBuilder.withPayload(payload).setHeader("topic", "topic") @@ -99,9 +99,9 @@ void testSnsMessageHandler() { Map messageAttributes = publishRequest.messageAttributes(); - assertThat(messageAttributes).doesNotContainKey(MessageHeaders.ID); - assertThat(messageAttributes).doesNotContainKey(MessageHeaders.TIMESTAMP); - assertThat(messageAttributes).containsKey("foo"); + assertThat(messageAttributes) + .doesNotContainKeys(MessageHeaders.ID, MessageHeaders.TIMESTAMP) + .containsKey("foo"); assertThat(messageAttributes.get("foo").stringValue()).isEqualTo("bar"); assertThat(reply.getHeaders().get(AwsHeaders.MESSAGE_ID)).isEqualTo("111"); diff --git a/src/test/java/org/springframework/integration/aws/outbound/SqsMessageHandlerTests.java b/src/test/java/org/springframework/integration/aws/outbound/SqsMessageHandlerTests.java index 2e2113eb..78d5958a 100644 --- a/src/test/java/org/springframework/integration/aws/outbound/SqsMessageHandlerTests.java +++ b/src/test/java/org/springframework/integration/aws/outbound/SqsMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * Copyright 2015-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ * @author Seth Kelly */ @SpringJUnitConfig -public class SqsMessageHandlerTests implements LocalstackContainerTest { +class SqsMessageHandlerTests implements LocalstackContainerTest { private static final AtomicReference fooUrl = new AtomicReference<>(); @@ -92,7 +92,7 @@ static void setup() { } @Test - void testSqsMessageHandler() { + void sqsMessageHandler() { final Message message = MessageBuilder.withPayload("message").build(); assertThatExceptionOfType(MessageHandlingException.class) @@ -139,14 +139,14 @@ void testSqsMessageHandler() { Map messageAttributes = message1.messageAttributes(); - assertThat(messageAttributes).doesNotContainKey(MessageHeaders.ID); - assertThat(messageAttributes).doesNotContainKey(MessageHeaders.TIMESTAMP); - assertThat(messageAttributes).containsKey("foo"); + assertThat(messageAttributes) + .doesNotContainKeys(MessageHeaders.ID, MessageHeaders.TIMESTAMP) + .containsKey("foo"); assertThat(messageAttributes.get("foo").stringValue()).isEqualTo("baz"); } @Test - void testSqsMessageHandlerWithAutoQueueCreate() { + void sqsMessageHandlerWithAutoQueueCreate() { Message message = MessageBuilder.withPayload("message").build(); this.sqsSendChannelWithAutoCreate.send(message);