RivenSun2 commented on code in PR #12010: URL: https://github.com/apache/kafka/pull/12010#discussion_r867284907
########## clients/src/test/java/org/apache/kafka/clients/CommonClientConfigsTest.java: ########## @@ -82,4 +102,21 @@ public void testExponentialBackoffDefaults() { assertEquals(Long.valueOf(123L), reconnectBackoffSetConf.getLong(CommonClientConfigs.RECONNECT_BACKOFF_MAX_MS_CONFIG)); } + + @Test + public void testInvalidSaslMechanism() { + Map<String, Object> configs = new HashMap<>(); + configs.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, SecurityProtocol.SASL_PLAINTEXT.name); + configs.put(SaslConfigs.SASL_MECHANISM, null); + ConfigException ce = assertThrows(ConfigException.class, () -> new TestConfig(configs)); + assertTrue(ce.getMessage().contains(SaslConfigs.SASL_MECHANISM)); + + configs.put(SaslConfigs.SASL_MECHANISM, ""); + ce = assertThrows(ConfigException.class, () -> new TestConfig(configs)); + assertTrue(ce.getMessage().contains(SaslConfigs.SASL_MECHANISM)); + + configs.put(SaslConfigs.SASL_MECHANISM, " "); Review Comment: Sure -- 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