TaiJuWu commented on code in PR #15916:
URL: https://github.com/apache/kafka/pull/15916#discussion_r1597748792


##########
core/src/test/java/kafka/test/junit/ClusterTestExtensions.java:
##########
@@ -93,24 +92,19 @@ public Stream<TestTemplateInvocationContext> 
provideTestTemplateInvocationContex
         // Process the @ClusterTemplate annotation
         ClusterTemplate clusterTemplateAnnot = 
context.getRequiredTestMethod().getDeclaredAnnotation(ClusterTemplate.class);
         if (clusterTemplateAnnot != null) {
-            processClusterTemplate(context, clusterTemplateAnnot, 
generatedContexts::add);
-            if (generatedContexts.isEmpty()) {
-                throw new IllegalStateException("ClusterConfig generator 
method should provide at least one config");
-            }
+            generatedContexts.addAll(processClusterTemplate(context, 
clusterTemplateAnnot));
         }
 
         // Process single @ClusterTest annotation
         ClusterTest clusterTestAnnot = 
context.getRequiredTestMethod().getDeclaredAnnotation(ClusterTest.class);
         if (clusterTestAnnot != null) {
-            processClusterTest(context, clusterTestAnnot, defaults, 
generatedContexts::add);
+            generatedContexts.addAll(processClusterTest(context, 
clusterTestAnnot, defaults));
         }
 
         // Process multiple @ClusterTest annotation within @ClusterTests
         ClusterTests clusterTestsAnnot = 
context.getRequiredTestMethod().getDeclaredAnnotation(ClusterTests.class);
         if (clusterTestsAnnot != null) {
-            for (ClusterTest annot : clusterTestsAnnot.value()) {
-                processClusterTest(context, annot, defaults, 
generatedContexts::add);
-            }
+            generatedContexts.addAll(processClusterTests(context, defaults));

Review Comment:
   There is some redunant code, I need to rework it. Thanks for your review.



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