3434import javax .crypto .KeyGenerator ;
3535import javax .crypto .SecretKey ;
3636import java .io .BufferedInputStream ;
37+ import java .io .ByteArrayInputStream ;
3738import java .io .IOException ;
3839import java .io .InputStream ;
3940import java .nio .charset .StandardCharsets ;
@@ -332,9 +333,12 @@ public void customSetBufferSizeWithLargeObject() throws IOException {
332333
333334 // Tight bound on the custom buffer size limit of 32MiB
334335 final long fileSizeExceedingDefaultLimit = 1024 * 1024 * 32 + 1 ;
335- final InputStream largeObjectStream = new BufferedInputStream (
336- new BoundedInputStream (fileSizeExceedingDefaultLimit )
337- );
336+
337+ byte [] data = new byte [(int ) fileSizeExceedingDefaultLimit ];
338+ for (int j =0 ; j < data .length ; j ++) {
339+ data [i ] = (byte ) (j % 256 );
340+ }
341+ final InputStream largeObjectStream = new ByteArrayInputStream (data );
338342 v3ClientWithBuffer32MiB .putObject (PutObjectRequest .builder ()
339343 .bucket (BUCKET )
340344 .key (objectKey )
@@ -352,8 +356,9 @@ public void customSetBufferSizeWithLargeObject() throws IOException {
352356 .bucket (BUCKET )
353357 .key (objectKey ));
354358
355-
356- assertTrue (IOUtils .contentEquals (new BoundedInputStream (fileSizeExceedingDefaultLimit ), response ));
359+ // Create a new ByteArrayInputStream for comparison
360+ InputStream expectedStream = new ByteArrayInputStream (data );
361+ assertTrue (IOUtils .contentEquals (expectedStream , response ));
357362 response .close ();
358363
359364 // Cleanup
0 commit comments