ashwinpankaj commented on code in PR #14888:
URL: https://github.com/apache/kafka/pull/14888#discussion_r1411930564


##########
clients/src/test/java/org/apache/kafka/common/security/oauthbearer/internals/secured/RefreshingHttpsJwksTest.java:
##########
@@ -62,14 +62,14 @@ public class RefreshingHttpsJwksTest extends 
OAuthBearerTest {
     @Test
     public void testBasicScheduleRefresh() throws Exception {
         String keyId = "abc123";
-        Time time = new MockTime();
+        MockTime time = new MockTime();
         HttpsJwks httpsJwks = spyHttpsJwks();
 
-        try (RefreshingHttpsJwks refreshingHttpsJwks = 
getRefreshingHttpsJwks(time, httpsJwks)) {
+        try (RefreshingHttpsJwks refreshingHttpsJwks = 
getRefreshingHttpsJwks(time, httpsJwks, mockExecutorService(time))) {
             refreshingHttpsJwks.init();
             verify(httpsJwks, times(1)).refresh();
             assertTrue(refreshingHttpsJwks.maybeExpediteRefresh(keyId));
-            verify(httpsJwks, times(1)).refresh();
+            verify(httpsJwks, times(2)).refresh();

Review Comment:
   Thanks @splett2 - so the assertion would fail whenever maybeExpediteRefresh 
actually ran !!
   nit: do you want to add a comment mentioning that mocktime is used to ensure 
that scheduled refresh doesn't run even once, thereby changing the invocation 
count ?
   
   LGTM



-- 
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]

Reply via email to