TaiJuWu commented on code in PR #15916: URL: https://github.com/apache/kafka/pull/15916#discussion_r1597748550
########## core/src/test/java/kafka/test/junit/ClusterTestExtensions.java: ########## @@ -140,8 +141,38 @@ private void generateClusterConfigurations(ExtensionContext context, String gene ReflectionUtils.invokeMethod(method, testInstance, generator); } - private void processClusterTest(ExtensionContext context, ClusterTest annot, ClusterTestDefaults defaults, - Consumer<TestTemplateInvocationContext> testInvocations) { + private List<TestTemplateInvocationContext> processClusterTests(ExtensionContext context, + ClusterTestDefaults defaults) { + + ClusterTests clusterTestsAnnot = context.getRequiredTestMethod().getDeclaredAnnotation(ClusterTests.class); + List<TestTemplateInvocationContext> ret = new ArrayList<>(); + + if (clusterTestsAnnot != null) { + for (ClusterTest annot : clusterTestsAnnot.value()) { + ret.addAll(processClusterTestInternal(context, annot, defaults)); + } + } + + if (ret.isEmpty()) { + throw new IllegalStateException("processClusterTests method should provide at least one config"); + } + + return ret; + } + + private List<TestTemplateInvocationContext> processClusterTest(ExtensionContext context, ClusterTest annot, + ClusterTestDefaults defaults) { + List<TestTemplateInvocationContext> ret = processClusterTestInternal(context, annot, defaults); + + if (ret.isEmpty()) { + throw new IllegalStateException("processClusterTest method should provide at least one config"); + } + + return ret; + } + + private List<TestTemplateInvocationContext> processClusterTestInternal(ExtensionContext context, ClusterTest annot, Review Comment: `processClusterTestInternal ` is used by `processClusterTest` and `processClusterTests` so we need to keep it. -- 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