Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void testSuccessActiveTaskCount() throws InterruptedException {
}

@Test
void testSuccessBlockingSubmissionPolicy() throws InterruptedException {
void testSuccessBlockingSubmissionPolicy() {
final AmazonSqsThreadPoolExecutor amazonSqsThreadPoolExecutor = new AmazonSqsThreadPoolExecutor(1);

amazonSqsThreadPoolExecutor.execute(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
class RingBufferBlockingQueueTest {

@Test
void testSuccess() throws InterruptedException {
void testSuccess() {
final ExecutorService producer = Executors.newSingleThreadExecutor();

final ScheduledExecutorService consumer = Executors.newSingleThreadScheduledExecutor();
Expand Down Expand Up @@ -85,7 +85,7 @@ void testSuccess() throws InterruptedException {
}

@Test
void testSuccessWhenIsEmpty() throws InterruptedException {
void testSuccessWhenIsEmpty() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = spy(new RingBufferBlockingQueue<>());

final ExecutorService producer = Executors.newSingleThreadExecutor();
Expand Down Expand Up @@ -114,7 +114,7 @@ void testSuccessWhenIsEmpty() throws InterruptedException {
}

@Test
void testSuccessWhenIsFull() throws InterruptedException {
void testSuccessWhenIsFull() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = spy(new RingBufferBlockingQueue<>(1));

final ExecutorService producer = Executors.newSingleThreadExecutor();
Expand Down Expand Up @@ -149,27 +149,27 @@ void testFailOffer() {
}

@Test
void testFailOfferWithParams() throws InterruptedException {
void testFailOfferWithParams() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = new RingBufferBlockingQueue<>();
assertThrows(UnsupportedOperationException.class, () -> ringBlockingQueue.offer(RequestEntry.<Integer>builder().withValue(0).build(), 1, TimeUnit.MILLISECONDS));
}

@Test
void testFailPoll() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = new RingBufferBlockingQueue<>();
assertThrows(UnsupportedOperationException.class, () -> ringBlockingQueue.poll());
assertThrows(UnsupportedOperationException.class, ringBlockingQueue::poll);
}

@Test
void testFailPollWithParams() throws InterruptedException {
void testFailPollWithParams() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = new RingBufferBlockingQueue<>();
assertThrows(UnsupportedOperationException.class, () -> ringBlockingQueue.poll(1, TimeUnit.MILLISECONDS));
}

@Test
void testFailIterator() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = new RingBufferBlockingQueue<>();
assertThrows(UnsupportedOperationException.class, () -> ringBlockingQueue.iterator());
assertThrows(UnsupportedOperationException.class, ringBlockingQueue::iterator);
}

@Test
Expand All @@ -181,7 +181,7 @@ void testFailAdd() {
@Test
void testFailRemainingCapacity() {
final RingBufferBlockingQueue<RequestEntry<Integer>> ringBlockingQueue = new RingBufferBlockingQueue<>();
assertThrows(UnsupportedOperationException.class, () -> ringBlockingQueue.remainingCapacity());
assertThrows(UnsupportedOperationException.class, ringBlockingQueue::remainingCapacity);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ static int batchSizeBytesThreshold() {
}

@Override
public void close() throws Exception {
public void close() {
shutdown();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void setUp() {
}

@Test
void testSendReturnsNonNullFuture() throws Exception {
void testSendReturnsNonNullFuture() {
final RequestEntry<String> entry = requestEntry();

final ListenableFuture<ResponseSuccessEntry, ResponseFailEntry> future = producer.send(entry);
Expand All @@ -81,7 +81,7 @@ void testSendReturnsNonNullFuture() throws Exception {
}

@Test
void testSendReturnsFutureOfCorrectType() throws Exception {
void testSendReturnsFutureOfCorrectType() {
final RequestEntry<String> entry = requestEntry();

final ListenableFuture<ResponseSuccessEntry, ResponseFailEntry> future = producer.send(entry);
Expand All @@ -90,7 +90,7 @@ void testSendReturnsFutureOfCorrectType() throws Exception {
}

@Test
void testSendRegistersPendingRequest() throws Exception {
void testSendRegistersPendingRequest() {
final RequestEntry<String> entry = requestEntry();

producer.send(entry);
Expand All @@ -99,7 +99,7 @@ void testSendRegistersPendingRequest() throws Exception {
}

@Test
void testSendEnqueuesEntryInqueueRequests() throws Exception {
void testSendEnqueuesEntryInqueueRequests() throws InterruptedException {
final RequestEntry<String> entry = requestEntry();

producer.send(entry);
Expand All @@ -108,7 +108,7 @@ void testSendEnqueuesEntryInqueueRequests() throws Exception {
}

@Test
void testSendStoredFutureMatchesReturnedFuture() throws Exception {
void testSendStoredFutureMatchesReturnedFuture() {
final RequestEntry<String> entry = requestEntry();

final ListenableFuture<ResponseSuccessEntry, ResponseFailEntry> future = producer.send(entry);
Expand All @@ -117,7 +117,7 @@ void testSendStoredFutureMatchesReturnedFuture() throws Exception {
}

@Test
void testSendMultipleEntriesRegistersAllPendingRequests() throws Exception {
void testSendMultipleEntriesRegistersAllPendingRequests() {
final RequestEntry<String> entry1 = requestEntry();
final RequestEntry<String> entry2 = requestEntry();
final RequestEntry<String> entry3 = requestEntry();
Expand All @@ -133,7 +133,7 @@ void testSendMultipleEntriesRegistersAllPendingRequests() throws Exception {
}

@Test
void testSendMultipleEntriesEnqueuesAllInqueueRequests() throws Exception {
void testSendMultipleEntriesEnqueuesAllInqueueRequests() throws InterruptedException {
final RequestEntry<String> entry1 = requestEntry();
final RequestEntry<String> entry2 = requestEntry();

Expand All @@ -145,15 +145,15 @@ void testSendMultipleEntriesEnqueuesAllInqueueRequests() throws Exception {
}

@Test
void testSendPropagatesInterruptedExceptionFromQueue() throws Exception {
void testSendPropagatesInterruptedExceptionFromQueue() throws InterruptedException {
final RequestEntry<String> entry = requestEntry();
doThrow(InterruptedException.class).when(queueRequests).put(any());

assertThrows(InterruptedException.class, () -> producer.send(entry));
}

@Test
void testShutdownInvokesExecutorServiceShutdown() throws Exception {
void testShutdownInvokesExecutorServiceShutdown() throws InterruptedException {
when(executorService.awaitTermination(anyLong(), any(TimeUnit.class))).thenReturn(true);

producer.shutdown();
Expand All @@ -162,7 +162,7 @@ void testShutdownInvokesExecutorServiceShutdown() throws Exception {
}

@Test
void testShutdownAwaitsTerminationWith60Seconds() throws Exception {
void testShutdownAwaitsTerminationWith60Seconds() throws InterruptedException {
when(executorService.awaitTermination(anyLong(), any(TimeUnit.class))).thenReturn(true);

producer.shutdown();
Expand All @@ -171,7 +171,7 @@ void testShutdownAwaitsTerminationWith60Seconds() throws Exception {
}

@Test
void testShutdownDoesNotCallShutdownNowWhenTerminatesInTime() throws Exception {
void testShutdownDoesNotCallShutdownNowWhenTerminatesInTime() throws InterruptedException {
when(executorService.awaitTermination(anyLong(), any(TimeUnit.class))).thenReturn(true);

producer.shutdown();
Expand All @@ -180,7 +180,7 @@ void testShutdownDoesNotCallShutdownNowWhenTerminatesInTime() throws Exception {
}

@Test
void testShutdownCallsShutdownNowWhenTerminationTimeoutExpires() throws Exception {
void testShutdownCallsShutdownNowWhenTerminationTimeoutExpires() throws InterruptedException {
when(executorService.awaitTermination(anyLong(), any(TimeUnit.class))).thenReturn(false);
doReturn(Collections.emptyList()).when(executorService).shutdownNow();

Expand All @@ -190,7 +190,7 @@ void testShutdownCallsShutdownNowWhenTerminationTimeoutExpires() throws Exceptio
}

@Test
void testShutdownForcesShutdownWhenPendingTasksRemain() throws Exception {
void testShutdownForcesShutdownWhenPendingTasksRemain() throws InterruptedException {
final List<Runnable> pendingTasks = Arrays.asList(mock(Runnable.class), mock(Runnable.class));
when(executorService.awaitTermination(anyLong(), any(TimeUnit.class))).thenReturn(false);
doReturn(pendingTasks).when(executorService).shutdownNow();
Expand All @@ -201,7 +201,7 @@ void testShutdownForcesShutdownWhenPendingTasksRemain() throws Exception {
}

@Test
void testShutdownCompletesGracefullyWhenNoTasksAreDropped() throws Exception {
void testShutdownCompletesGracefullyWhenNoTasksAreDropped() throws InterruptedException {
when(executorService.awaitTermination(anyLong(), any(TimeUnit.class))).thenReturn(false);
doReturn(Collections.emptyList()).when(executorService).shutdownNow();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AmazonSqsProducerAsyncTest {
private AmazonSQS amazonSQS;

@BeforeEach
public void before() throws Exception {
public void before() {
final QueueProperty queueProperty = QueueProperty.builder()
.fifo(false)
.linger(50L)
Expand Down Expand Up @@ -153,7 +153,7 @@ void testFailureMultipleEntry() {
final SendMessageBatchRequest request = invocation.getArgument(0, SendMessageBatchRequest.class);
final List<BatchResultErrorEntry> resultEntries = request.getEntries().stream()
.map(entry -> new BatchResultErrorEntry().withId(entry.getId()))
.collect(Collectors.toList());;
.collect(Collectors.toList());
return new SendMessageBatchResult().withFailed(resultEntries);
});

Expand Down Expand Up @@ -228,7 +228,7 @@ void testSuccessBlockingSubmissionPolicy() {
}));

entries(2).forEach(entry -> {
sqsTemplate.send(entry).addCallback(null, failureCallback);;
sqsTemplate.send(entry).addCallback(null, failureCallback);
});

verify(failureCallback, timeout(40000).times(1)).accept(any());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AmazonSqsProducerSyncTest {
private AmazonSQS amazonSQS;

@BeforeEach
public void before() throws Exception {
public void before() {
final QueueProperty queueProperty = QueueProperty.builder()
.fifo(true)
.linger(50L)
Expand Down Expand Up @@ -124,7 +124,7 @@ void testSuccessMultipleEntry() {
final SendMessageBatchRequest request = invocation.getArgument(0, SendMessageBatchRequest.class);
final List<SendMessageBatchResultEntry> resultEntries = request.getEntries().stream()
.map(entry -> new SendMessageBatchResultEntry().withId(entry.getId()))
.collect(Collectors.toList());;
.collect(Collectors.toList());
return new SendMessageBatchResult().withSuccessful(resultEntries);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AmazonSqsProducerAsyncTest {
private SqsClient amazonSQS;

@BeforeEach
public void before() throws Exception {
public void before() {
final QueueProperty queueProperty = QueueProperty.builder()
.fifo(false)
.linger(50L)
Expand Down Expand Up @@ -129,7 +129,7 @@ void testSuccessMultipleEntry() {
final SendMessageBatchRequest request = invocation.getArgument(0, SendMessageBatchRequest.class);
final List<SendMessageBatchResultEntry> resultEntries = request.entries().stream()
.map(entry -> SendMessageBatchResultEntry.builder().id(entry.id()).build())
.collect(Collectors.toList());;
.collect(Collectors.toList());
return SendMessageBatchResponse.builder().successful(resultEntries).build();
});

Expand All @@ -154,7 +154,7 @@ void testFailureMultipleEntry() {
final SendMessageBatchRequest request = invocation.getArgument(0, SendMessageBatchRequest.class);
final List<BatchResultErrorEntry> resultEntries = request.entries().stream()
.map(entry -> BatchResultErrorEntry.builder().id(entry.id()).build())
.collect(Collectors.toList());;
.collect(Collectors.toList());
return SendMessageBatchResponse.builder().failed(resultEntries).build();
});

Expand Down Expand Up @@ -229,7 +229,7 @@ void testSuccessBlockingSubmissionPolicy() {
}));

entries(2).forEach(entry -> {
sqsTemplate.send(entry).addCallback(null, failureCallback);;
sqsTemplate.send(entry).addCallback(null, failureCallback);
});

verify(failureCallback, timeout(40000).times(1)).accept(any());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AmazonSqsProducerSyncTest {
private SqsClient amazonSQS;

@BeforeEach
public void before() throws Exception {
public void before() {
final QueueProperty queueProperty = QueueProperty.builder()
.fifo(true)
.linger(50L)
Expand Down Expand Up @@ -126,7 +126,7 @@ void testSuccessMultipleEntry() {
final SendMessageBatchRequest request = invocation.getArgument(0, SendMessageBatchRequest.class);
final List<SendMessageBatchResultEntry> resultEntries = request.entries().stream()
.map(entry -> SendMessageBatchResultEntry.builder().id(entry.id()).build())
.collect(Collectors.toList());;
.collect(Collectors.toList());
return SendMessageBatchResponse.builder().successful(resultEntries).build();
});

Expand All @@ -151,7 +151,7 @@ void testFailureMultipleEntry() {
final SendMessageBatchRequest request = invocation.getArgument(0, SendMessageBatchRequest.class);
final List<BatchResultErrorEntry> resultEntries = request.entries().stream()
.map(entry -> BatchResultErrorEntry.builder().id(entry.id()).build())
.collect(Collectors.toList());;
.collect(Collectors.toList());
return SendMessageBatchResponse.builder().failed(resultEntries).build();
});

Expand Down