2828import java .util .concurrent .ExecutionException ;
2929import java .util .concurrent .Flow ;
3030import java .util .concurrent .TimeoutException ;
31- import java .util .Optional ;
3231
3332import org .junit .jupiter .api .Test ;
3433import org .junit .jupiter .params .ParameterizedTest ;
@@ -393,11 +392,11 @@ public void forFile_SendOptions(boolean useCache, boolean useHashLookup) throws
393392 argThat (getRequest -> getRequest != null
394393 && getRequest .method ().equals ("GET" )
395394 && getRequest .uri ().toString ().contains (
396- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
395+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
397396 && getRequest .uri ().toString ()
398- .contains ("useCache=" + Boolean .toString (useCache ))
397+ .contains ("useCache=" + Boolean .toString (useCache ))
399398 && getRequest .uri ().toString ().contains (
400- "useHashLookup=" + Boolean .toString (useHashLookup ))),
399+ "useHashLookup=" + Boolean .toString (useHashLookup ))),
401400 any (HttpResponse .BodyHandler .class )))
402401 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
403402
@@ -406,12 +405,12 @@ public void forFile_SendOptions(boolean useCache, boolean useHashLookup) throws
406405 argThat (getRequest -> getRequest != null
407406 && getRequest .method ().equals ("GET" )
408407 && getRequest .uri ().toString ().contains (
409- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
408+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
410409 && getRequest .uri ().toString ()
411- .contains ("useCache=" + Boolean .toString (true ))
410+ .contains ("useCache=" + Boolean .toString (true ))
412411 && getRequest .uri ().toString ()
413- .contains ("useHashLookup=" + Boolean
414- .toString (useHashLookup ))),
412+ .contains ("useHashLookup=" + Boolean
413+ .toString (useHashLookup ))),
415414 any (HttpResponse .BodyHandler .class )))
416415 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
417416 }
@@ -421,7 +420,7 @@ public void forFile_SendOptions(boolean useCache, boolean useHashLookup) throws
421420 && postRequest .method ().equals ("POST" )
422421 && postRequest .uri ().toString ().contains ("files" )
423422 && postRequest .uri ().toString ().contains (
424- "useHashLookup=" + Boolean .toString (useHashLookup ))),
423+ "useHashLookup=" + Boolean .toString (useHashLookup ))),
425424 any (HttpResponse .BodyHandler .class )))
426425 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
427426
@@ -471,13 +470,13 @@ public void forFile_SendUserAgent() throws Exception {
471470 argThat (getRequest -> getRequest != null
472471 && getRequest .method ().equals ("GET" )
473472 && getRequest .uri ().toString ().contains (
474- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
473+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
475474 && getRequest .uri ().toString ()
476- .contains ("useCache=" + Boolean .toString (true ))
475+ .contains ("useCache=" + Boolean .toString (true ))
477476 && getRequest .uri ().toString ()
478- .contains ("useHashLookup=" + Boolean .toString (true ))
477+ .contains ("useHashLookup=" + Boolean .toString (true ))
479478 && getRequest .headers ().firstValue ("User-Agent" ).toString ()
480- .contains ("Java" )),
479+ .contains ("Java" )),
481480 any (HttpResponse .BodyHandler .class )))
482481 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
483482
@@ -486,9 +485,9 @@ public void forFile_SendUserAgent() throws Exception {
486485 && postRequest .method ().equals ("POST" )
487486 && postRequest .uri ().toString ().contains ("files" )
488487 && postRequest .uri ().toString ()
489- .contains ("useHashLookup=" + Boolean .toString (true ))
488+ .contains ("useHashLookup=" + Boolean .toString (true ))
490489 && postRequest .headers ().firstValue ("User-Agent" ).toString ()
491- .contains ("Java" )),
490+ .contains ("Java" )),
492491 any (HttpResponse .BodyHandler .class )))
493492 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
494493
@@ -534,13 +533,13 @@ public void forFile_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
534533 argThat (getRequest -> getRequest != null
535534 && getRequest .method ().equals ("GET" )
536535 && getRequest .uri ().toString ().contains (
537- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
536+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
538537 && getRequest .uri ().toString ()
539- .contains ("useCache=" + Boolean .toString (true ))
538+ .contains ("useCache=" + Boolean .toString (true ))
540539 && getRequest .uri ().toString ()
541- .contains ("useHashLookup=" + Boolean .toString (true ))
540+ .contains ("useHashLookup=" + Boolean .toString (true ))
542541 && getRequest .headers ().firstValue ("tracestate" ).toString ()
543- .contains ("foobar" )),
542+ .contains ("foobar" )),
544543 any (HttpResponse .BodyHandler .class )))
545544 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
546545
@@ -549,9 +548,9 @@ public void forFile_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
549548 && postRequest .method ().equals ("POST" )
550549 && postRequest .uri ().toString ().contains ("files" )
551550 && postRequest .uri ().toString ()
552- .contains ("useHashLookup=" + Boolean .toString (true ))
551+ .contains ("useHashLookup=" + Boolean .toString (true ))
553552 && postRequest .headers ().firstValue ("tracestate" ).toString ()
554- .contains ("foobar" )),
553+ .contains ("foobar" )),
555554 any (HttpResponse .BodyHandler .class )))
556555 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
557556
@@ -684,6 +683,7 @@ public void forFile_IfUnauthorized_ThrowsVaasAuthenticationException()
684683 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
685684
686685 when (mockHttpClient .sendAsync (
686+ argThat (postRequest -> postRequest != null
687687 && postRequest .method ().equals ("POST" )),
688688 any (HttpResponse .BodyHandler .class )))
689689 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
@@ -784,12 +784,12 @@ public void forStream_SendOptions(boolean useHashLookup) throws Exception {
784784 argThat (getRequest -> getRequest != null
785785 && getRequest .method ().equals ("GET" )
786786 && getRequest .uri ().toString ().contains (
787- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
787+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
788788 && getRequest .uri ().toString ()
789- .contains ("useCache=" + Boolean .toString (true ))
789+ .contains ("useCache=" + Boolean .toString (true ))
790790 && getRequest .uri ().toString ()
791- .contains ("useHashLookup=" + Boolean
792- .toString (useHashLookup ))),
791+ .contains ("useHashLookup=" + Boolean
792+ .toString (useHashLookup ))),
793793 any (HttpResponse .BodyHandler .class )))
794794 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
795795
@@ -798,7 +798,7 @@ public void forStream_SendOptions(boolean useHashLookup) throws Exception {
798798 && postRequest .method ().equals ("POST" )
799799 && postRequest .uri ().toString ().contains ("files" )
800800 && postRequest .uri ().toString ().contains (
801- "useHashLookup=" + Boolean .toString (useHashLookup ))),
801+ "useHashLookup=" + Boolean .toString (useHashLookup ))),
802802 any (HttpResponse .BodyHandler .class )))
803803 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
804804
@@ -843,20 +843,24 @@ public void forStream_SendUserAgent() throws Exception {
843843 argThat (getRequest -> getRequest != null
844844 && getRequest .method ().equals ("GET" )
845845 && getRequest .uri ().toString ().contains (
846- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
846+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
847847 && getRequest .uri ().toString ()
848- .contains ("useCache=" + Boolean .toString (true ))
848+ .contains ("useCache=" + Boolean .toString (true ))
849849 && getRequest .uri ().toString ()
850- .contains ("useHashLookup=" + Boolean .toString (true ))
850+ .contains ("useHashLookup=" + Boolean .toString (true ))
851851 && getRequest .headers ().firstValue ("User-Agent" ).toString ()
852+ .contains ("Java" )),
853+ any (HttpResponse .BodyHandler .class )))
854+ .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
855+
852856 when (mockHttpClient .sendAsync (
853857 argThat (postRequest -> postRequest != null
854858 && postRequest .method ().equals ("POST" )
855859 && postRequest .uri ().toString ().contains ("files" )
856860 && postRequest .uri ().toString ()
857- .contains ("useHashLookup=" + Boolean .toString (true ))
861+ .contains ("useHashLookup=" + Boolean .toString (true ))
858862 && postRequest .headers ().firstValue ("User-Agent" ).toString ()
859- .contains ("Java" )),
863+ .contains ("Java" )),
860864 any (HttpResponse .BodyHandler .class )))
861865 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
862866
@@ -899,13 +903,13 @@ public void forStream_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
899903 argThat (getRequest -> getRequest != null
900904 && getRequest .method ().equals ("GET" )
901905 && getRequest .uri ().toString ().contains (
902- "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
906+ "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f" )
903907 && getRequest .uri ().toString ()
904- .contains ("useCache=" + Boolean .toString (true ))
908+ .contains ("useCache=" + Boolean .toString (true ))
905909 && getRequest .uri ().toString ()
906- .contains ("useHashLookup=" + Boolean .toString (true ))
910+ .contains ("useHashLookup=" + Boolean .toString (true ))
907911 && getRequest .headers ().firstValue ("tracestate" ).toString ()
908- .contains ("foobar" )),
912+ .contains ("foobar" )),
909913 any (HttpResponse .BodyHandler .class )))
910914 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
911915
@@ -914,9 +918,9 @@ public void forStream_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
914918 && postRequest .method ().equals ("POST" )
915919 && postRequest .uri ().toString ().contains ("files" )
916920 && postRequest .uri ().toString ()
917- .contains ("useHashLookup=" + Boolean .toString (true ))
921+ .contains ("useHashLookup=" + Boolean .toString (true ))
918922 && postRequest .headers ().firstValue ("tracestate" ).toString ()
919- .contains ("foobar" )),
923+ .contains ("foobar" )),
920924 any (HttpResponse .BodyHandler .class )))
921925 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
922926
@@ -1185,7 +1189,7 @@ public void forUrl_SendUserAgent() throws Exception {
11851189 && getRequest .method ().equals ("GET" )
11861190 && getRequest .uri ().toString ().contains ("id" )
11871191 && getRequest .headers ().firstValue ("User-Agent" ).toString ()
1188- .contains ("Java" )),
1192+ .contains ("Java" )),
11891193 any (HttpResponse .BodyHandler .class )))
11901194 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
11911195
@@ -1194,7 +1198,7 @@ public void forUrl_SendUserAgent() throws Exception {
11941198 && postRequest .method ().equals ("POST" )
11951199 && postRequest .uri ().toString ().contains ("urls" )
11961200 && postRequest .headers ().firstValue ("User-Agent" ).toString ()
1197- .contains ("Java" )),
1201+ .contains ("Java" )),
11981202 any (HttpResponse .BodyHandler .class )))
11991203 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
12001204
@@ -1235,7 +1239,7 @@ public void forUrl_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
12351239 && getRequest .method ().equals ("GET" )
12361240 && getRequest .uri ().toString ().contains ("id" )
12371241 && getRequest .headers ().firstValue ("tracestate" ).toString ()
1238- .contains ("foobar" )),
1242+ .contains ("foobar" )),
12391243 any (HttpResponse .BodyHandler .class )))
12401244 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockGetResponse ));
12411245
@@ -1244,7 +1248,7 @@ public void forUrl_IfVaasRequestIdIsSet_SendTraceState() throws Exception {
12441248 && postRequest .method ().equals ("POST" )
12451249 && postRequest .uri ().toString ().contains ("urls" )
12461250 && postRequest .headers ().firstValue ("tracestate" ).toString ()
1247- .contains ("foobar" )),
1251+ .contains ("foobar" )),
12481252 any (HttpResponse .BodyHandler .class )))
12491253 .thenAnswer (invocation -> CompletableFuture .completedFuture (mockPostResponse ));
12501254
@@ -1372,4 +1376,4 @@ public void forUrl_IfCancellationIsRequested_ThrowsCancellationException()
13721376 assertTrue (result );
13731377 assertThrows (CancellationException .class , future ::get );
13741378 }
1375- }
1379+ }
0 commit comments