showuon commented on a change in pull request #11837: URL: https://github.com/apache/kafka/pull/11837#discussion_r826766945
########## File path: clients/src/test/java/org/apache/kafka/common/config/ConfigDefTest.java ########## @@ -722,4 +724,35 @@ public void testNiceTimeUnits() { assertEquals(" (365 days)", ConfigDef.niceTimeUnits(Duration.ofDays(365).toMillis())); } + @Test + public void testThrowsExceptionWhenListSizeExceedsLimit() { + assertThrows(ConfigException.class, () -> new ConfigDef().define("lst", + Type.LIST, + asList("a", "b"), + ListSize.atMostOfSize(1), + Importance.HIGH, + "lst doc")); + } + + @Test + public void testNoExceptionIsThrownWhenListSizeEqualsTheLimit() { + final List<String> lst = asList("a", "b", "c"); + new ConfigDef().define("lst", Review comment: We can use `assertDoesNotThrow` here and below. -- 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