ok2c commented on code in PR #802:
URL: 
https://github.com/apache/httpcomponents-client/pull/802#discussion_r2813382093


##########
httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java:
##########
@@ -400,10 +408,11 @@ void 
testBasicAuthenticationCredentialsCachingByPathPrefix() throws Exception {
         }
 
         // There should be an auth strategy call for all successful message 
exchanges
-        Mockito.verify(authStrategy, Mockito.times(2)).select(Mockito.any(), 
Mockito.any(), Mockito.any());
+        Mockito.verify(authStrategy, Mockito.times(3)).select(Mockito.any(), 
Mockito.any(), Mockito.any());
 
-        Assertions.assertEquals(Arrays.asList(200, 401, 200, 200, 401, 200),
-                
responseQueue.stream().map(HttpResponse::getCode).collect(Collectors.toList()));
+        assertThat(
+                
responseQueue.stream().map(HttpResponse::getCode).collect(Collectors.toList()),
+                CoreMatchers.equalTo(Arrays.asList(200, 401, 200, 401, 200, 
401, 200)));

Review Comment:
   > Instead of remembering only the last prefix, one could keep a list of 
cached prefixes.
   
   @rPraml This is how the auth cache works already. The cache key consists of 
4 elements including `pathPrefix`.
   
   ```
       static class Key {
   
           final String scheme;
           final String host;
           final int port;
           final String pathPrefix;
   ```
   
   The '/blah/a', '/yada/a', '/blah/b', '/yada/', '/blah/c' sequence should 
result in 401, 200, 401, 200, 200, 200, 200 response sequence. If it does not, 
something is wrong.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to