Annotation Interface ClusterTemplate


@Documented @Target(METHOD) @Retention(RUNTIME) @TestTemplate @Tag("integration") public @interface ClusterTemplate
Used to indicate that a test should call the method given by value() to generate a number of cluster configurations. The test-containing class must define a static method which takes no arguments and returns a list of ClusterConfig, used to generate multiple cluster configurations. The method given here must be static since it is invoked before any tests are actually run. Each test generated by this annotation will run as if it was defined as a separate test method with its own Test. That is to say, each generated test invocation will have a separate lifecycle. This annotation may be used in conjunction with ClusterTest and ClusterTests which also yield ClusterConfig instances. For Scala tests, the method should be defined in a companion object with the same name as the test class. Usage looks something like this:

 private static List<ClusterConfig> generator() {
     return List.of(ClusterConfig.defaultBuilder().build());
 }

 @ClusterTemplate("generator")
 public void testGenerateClusterTemplate(ClusterInstance clusterInstance) {
     assertNotNull(clusterInstance.bootstrapServers());
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Specify the static method used for generating cluster configs
  • Element Details

    • value

      String value
      Specify the static method used for generating cluster configs