SamBarker commented on code in PR #12179: URL: https://github.com/apache/kafka/pull/12179#discussion_r894104883
########## clients/src/test/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticatorTest.java: ########## @@ -126,40 +135,94 @@ public void testUnexpectedRequestType() throws IOException { @Test public void testOldestApiVersionsRequest() throws IOException { testApiVersionsRequest(ApiKeys.API_VERSIONS.oldestVersion(), - ClientInformation.UNKNOWN_NAME_OR_VERSION, ClientInformation.UNKNOWN_NAME_OR_VERSION); + ClientInformation.UNKNOWN_NAME_OR_VERSION, ClientInformation.UNKNOWN_NAME_OR_VERSION); } @Test public void testLatestApiVersionsRequest() throws IOException { testApiVersionsRequest(ApiKeys.API_VERSIONS.latestVersion(), - "apache-kafka-java", AppInfoParser.getVersion()); + "apache-kafka-java", AppInfoParser.getVersion()); } @Test - public void testExpiredCredentialLifetime() throws IOException { + public void testSessionExpirationLeftAsNullButLifetimeReturnedToTheClientWhenReauthDisabled() throws IOException { String mechanism = OAuthBearerLoginModule.OAUTHBEARER_MECHANISM; + Duration tokenExpirationDuration = Duration.ofSeconds(100); SaslServer saslServer = mock(SaslServer.class); - when(saslServer.getMechanismName()).thenReturn(mechanism); - when(saslServer.evaluateResponse(any())).thenReturn(new byte[]{}); - when(saslServer.getNegotiatedProperty(eq(SaslInternalConfigs.CREDENTIAL_LIFETIME_MS_SASL_NEGOTIATED_PROPERTY_KEY))).thenReturn(1L); - KafkaPrincipalBuilder kafkaPrincipalBuilder = mock(KafkaPrincipalBuilder.class); - when(kafkaPrincipalBuilder.build(any())).thenReturn(new KafkaPrincipal("[principal-type]", "[principal-name")); + + MockTime time = new MockTime(); Review Comment: I agree I don't tend to be overly bothered by DRY in tests and its about read ability thus being able to easily see what the test is trying to prove. I think the tests are fine as is, anything else is just polish and style changes. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org