|
26 | 26 | import static org.junit.jupiter.api.Assertions.assertThrows; |
27 | 27 | import static org.junit.jupiter.api.Assertions.assertTrue; |
28 | 28 | import static org.mockito.Mockito.any; |
29 | | -import static org.mockito.Mockito.doThrow; |
30 | 29 | import static org.mockito.Mockito.mock; |
31 | | -import static org.mockito.Mockito.never; |
32 | | -import static org.mockito.Mockito.spy; |
33 | | -import static org.mockito.Mockito.times; |
34 | | -import static org.mockito.Mockito.verify; |
35 | 30 | import static org.mockito.Mockito.when; |
36 | 31 |
|
37 | 32 | import java.io.ByteArrayInputStream; |
@@ -181,6 +176,7 @@ void isRepeatable_WithNonMarkSupportedStream_ReturnsFalse() { |
181 | 176 | public int read() { |
182 | 177 | return -1; |
183 | 178 | } |
| 179 | + |
184 | 180 | @Override |
185 | 181 | public boolean markSupported() { |
186 | 182 | return false; |
@@ -208,7 +204,7 @@ void writeTo_FirstAttempt_DoesNotResetStream() throws IOException { |
208 | 204 | AtomicInteger resetCallCount = new AtomicInteger(0); |
209 | 205 | ByteArrayInputStream trackingStream = new ByteArrayInputStream(content.getBytes()) { |
210 | 206 | @Override |
211 | | - public synchronized void reset() { |
| 207 | + public synchronized void reset() { |
212 | 208 | resetCallCount.incrementAndGet(); |
213 | 209 | super.reset(); |
214 | 210 | } |
@@ -239,7 +235,7 @@ void writeTo_SubsequentAttemptWithRepeatableStream_ResetsStream() throws IOExcep |
239 | 235 | AtomicInteger resetCallCount = new AtomicInteger(0); |
240 | 236 | ByteArrayInputStream trackingStream = new ByteArrayInputStream(content.getBytes()) { |
241 | 237 | @Override |
242 | | - public synchronized void reset() { |
| 238 | + public synchronized void reset() { |
243 | 239 | resetCallCount.incrementAndGet(); |
244 | 240 | super.reset(); |
245 | 241 | } |
@@ -452,8 +448,8 @@ void writeTo_MultipleWrites_AllSucceed() throws IOException { |
452 | 448 | } |
453 | 449 |
|
454 | 450 | @Test |
455 | | - @DisplayName("Entity should handle mixed headers correctly") |
456 | | - void constructor_WithMixedHeaders_HandlesAllCorrectly() { |
| 451 | + @DisplayName("Entity should handle multiple headers correctly") |
| 452 | + void constructor_WithMultiHeaders_HandlesAllCorrectly() { |
457 | 453 | // Given |
458 | 454 | SdkHttpRequest httpRequest = httpRequestBuilder |
459 | 455 | .putHeader("Content-Length", "2048") |
@@ -548,8 +544,8 @@ public boolean markSupported() { |
548 | 544 | } |
549 | 545 |
|
550 | 546 | @Test |
551 | | - @DisplayName("Entity should handle partial stream reads") |
552 | | - void writeTo_PartialReads_CompletesSuccessfully() throws IOException { |
| 547 | + @DisplayName("Entity should handle non repeatable data arriving in chunks") |
| 548 | + void writeTo_withChunkedReads_CompletesSuccessfully() throws IOException { |
553 | 549 | // Given - Stream that returns data in small chunks |
554 | 550 | String content = "This is a test content that will be read in chunks"; |
555 | 551 | InputStream chunkingStream = new InputStream() { |
@@ -650,7 +646,6 @@ public synchronized void reset() throws IOException { |
650 | 646 | entity.writeTo(output1); |
651 | 647 | entity.writeTo(output2); |
652 | 648 |
|
653 | | - |
654 | 649 | assertEquals(content, output1.toString()); |
655 | 650 | assertEquals(content, output2.toString()); |
656 | 651 | } |
|
0 commit comments