Skip to content

Commit 749fc3c

Browse files
committed
Unit test fixed
1 parent 45a9635 commit 749fc3c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

services/s3/src/test/java/software/amazon/awssdk/services/s3/internal/multipart/MultipartDownloaderSubscriberPartCountValidationTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,17 @@ void callCountMatchesTotalParts_shouldPass() throws InterruptedException {
8585
}
8686

8787
@Test
88-
void callCountLessThanTotalParts_shouldThrowException() throws InterruptedException {
89-
subscriber = new MultipartDownloaderSubscriber(s3Client, getObjectRequest);
90-
GetObjectResponse response1 = createMockResponse(3, "etag1");
91-
GetObjectResponse response2 = createMockResponse(3, "etag2");
88+
void callCountMoreThanTotalParts_shouldThrowException() throws InterruptedException {
89+
subscriber = new MultipartDownloaderSubscriber(s3Client, getObjectRequest, 3);
90+
GetObjectResponse response1 = createMockResponse(2, "etag1");
9291

9392
CompletableFuture<GetObjectResponse> future1 = CompletableFuture.completedFuture(response1);
94-
CompletableFuture<GetObjectResponse> future2 = CompletableFuture.completedFuture(response2);
9593

9694
when(s3Client.getObject(any(GetObjectRequest.class), eq(responseTransformer)))
97-
.thenReturn(future1, future2);
95+
.thenReturn(future1);
9896

9997
subscriber.onSubscribe(subscription);
10098
subscriber.onNext(responseTransformer);
101-
subscriber.onNext(responseTransformer);
10299
Thread.sleep(100);
103100

104101
subscriber.onComplete();
@@ -107,7 +104,7 @@ void callCountLessThanTotalParts_shouldThrowException() throws InterruptedExcept
107104
() -> subscriber.future().get(1, TimeUnit.SECONDS));
108105
assertTrue(exception.getCause() instanceof SdkClientException);
109106
assertTrue(exception.getCause().getMessage().contains("PartsCount validation failed"));
110-
assertTrue(exception.getCause().getMessage().contains("Expected 3, downloaded 2 parts"));
107+
assertTrue(exception.getCause().getMessage().contains("Expected 2, downloaded 4 parts"));
111108

112109
}
113110

0 commit comments

Comments
 (0)