mumrah commented on code in PR #18907:
URL: https://github.com/apache/kafka/pull/18907#discussion_r1957162844
##########
test-common/test-common-internal-api/src/main/java/org/apache/kafka/common/test/api/ClusterTemplate.java:
##########
@@ -30,9 +30,9 @@
/**
* Used to indicate that a test should call the method given by {@link
#value()} to generate a number of
- * cluster configurations. The method specified by the value should accept a
single argument of the type
- * {@link ClusterGenerator}. Any return value from the method is ignored. A
test invocation
- * will be generated for each {@link ClusterConfig} provided to the
ClusterGenerator instance.
+ * cluster configurations. The method specified by the value does not accept
any arguments.
Review Comment:
Looking at how we actually invoke the template methods
```
Object testInstance = context.getTestInstance().orElse(null);
Method method =
ReflectionUtils.getRequiredMethod(context.getRequiredTestClass(),
generateClustersMethods);
return (List<ClusterConfig>) ReflectionUtils.invokeMethod(method,
testInstance);
```
We make a few assumptions
1) The method is defined within the class that contains the test
2) The method may be static
3) No arguments are passed
4) A list of ClusterConfigs is returned
I think it would be good to specify these restrictions in the javadoc and
give an example in a `<pre>` block.
Also, we may as well fix the argument name "generateClustersMethods" in
ClusterTestExtensions#generateClusterConfigurations (it should not be plural).
--
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]