@@ -606,35 +606,29 @@ public void downloadStreamWithResponseContentValidation() throws IOException {
606606 @ Test
607607 public void downloadStreamWithResponseContentValidationRange () throws IOException {
608608 byte [] randomData = getRandomByteArray (Constants .KB );
609-
610- // Encode the data using StructuredMessageEncoder to enable proper structured message validation
611- StructuredMessageEncoder encoder = new StructuredMessageEncoder (randomData .length , 512 , StructuredMessageFlags .STORAGE_CRC64 );
612- ByteBuffer encodedData = encoder .encode (ByteBuffer .wrap (randomData ));
613-
614- Flux <ByteBuffer > input = Flux .just (encodedData );
609+ Flux <ByteBuffer > input = Flux .just (ByteBuffer .wrap (randomData ));
615610
616- // Create validation options with structured message validation enabled
611+ // For range downloads, we don't use structured message validation because:
612+ // 1. Ranges apply to the encoded data, not original data
613+ // 2. Partial structured messages cannot be properly validated
614+ // This test validates that the API integration works with range downloads when validation is disabled
617615 DownloadContentValidationOptions validationOptions = new DownloadContentValidationOptions ()
618- .setStructuredMessageValidationEnabled (true );
616+ .setStructuredMessageValidationEnabled (false );
619617
620- // Test range download - note that range should be applied to the encoded data, not original data
621618 BlobRange range = new BlobRange (0 , 512L );
622-
619+ byte [] expectedData = new byte [512 ];
620+ System .arraycopy (randomData , 0 , expectedData , 0 , 512 );
621+
623622 StepVerifier
624623 .create (bc .upload (input , null , true )
625624 .then (bc .downloadStreamWithResponse (range , null , null , false , validationOptions ))
626625 .flatMap (r -> FluxUtil .collectBytesInByteBufferStream (r .getValue ())))
627- .assertNext (r -> {
628- // With range downloads on structured messages, we get a partial structured message
629- // The exact validation depends on the range, but the test ensures the API integration works
630- assertNotNull (r );
631- assertTrue (r .length > 0 );
632- })
626+ .assertNext (r -> TestUtils .assertArraysEqual (r , expectedData ))
633627 .verifyComplete ();
634628 }
635629
636630 @ Test
637- public void downloadStreamWithResponseContentValidationMixed () throws IOException {
631+ public void downloadStreamWithResponseStructuredMessageValidation () throws IOException {
638632 byte [] randomData = getRandomByteArray (Constants .KB );
639633
640634 // Encode the data using StructuredMessageEncoder to enable proper structured message validation
@@ -643,7 +637,7 @@ public void downloadStreamWithResponseContentValidationMixed() throws IOExceptio
643637
644638 Flux <ByteBuffer > input = Flux .just (encodedData );
645639
646- // Create validation options with structured message validation enabled (disable MD5 to avoid range conflicts)
640+ // Create validation options with only structured message validation enabled
647641 DownloadContentValidationOptions validationOptions = new DownloadContentValidationOptions ()
648642 .setStructuredMessageValidationEnabled (true )
649643 .setMd5ValidationEnabled (false );
0 commit comments